View Helpers
View Helpers
authenticityTokenField()— Returns a hidden form field containing a new authenticity token.autoLink()— Turns all URLs and email addresses into links.buttonTag()— Builds and returns a string containing a button form control.buttonTo()— Creates a form containing a single button that submits to the URL. Note: Pass any additional arguments by prefixing themcheckBox()— Builds and returns a string containing a check box form control based on the supplied name.checkBoxTag()— Builds and returns a string containing a check box form control based on the supplied name.colorField()— Builds and returns a string containing a color picker form control based on the supplied objectName and property.colorFieldTag()— Builds and returns a string containing a color picker form control based on the supplied name.contentFor()— Used to store a section’s output for rendering within a layout.contentForLayout()— Includes content for the body section, which equates to the output generated by the view template run by the request.csrfMetaTags()— Include this in your layouts’headsections to include meta tags containing the authenticity token for usecycle()— Cycles through list values every time it is called.dateField()— Builds and returns a string containing a date field form control based on the supplied objectName and property.dateFieldTag()— Builds and returns a string containing a date field form control based on the supplied name.dateSelect()— Builds and returns a string containing threeselectform controls for month, day, and year based on the supdateSelectTags()— Builds and returns a string containing threeselectform controls (month, day, and year) based on a name andateTimeSelect()— Builds and returns a string containing sixselectform controls (three for date selection and the remainingdateTimeSelectTags()— Builds and returns a string containing sixselectform controls (three for date selection and the remainingdaySelectTag()— Builds and returns a string containing aselectform control for the days of the week based on the suppliedemailField()— Builds and returns a string containing an email field form control based on the supplied objectName and property.emailFieldTag()— Builds and returns a string containing an email field form control based on the supplied name.endFormTag()— Builds and returns a string containing the closingformtag.errorMessageOn()— Returns the error message, if one exists, on the object’s property.errorMessagesFor()— Builds and returns a list (ultag with a defaultclassoferror-messages) containfileField()— Builds and returns a string containing a file field form control based on the supplied objectName and property.fileFieldTag()— Builds and returns a string containing a file form control based on the supplied name.firstPageLink()— Creates a link to the first page, or a disabled span when already on the first page.flashMessages()— Displays a marked-up listing of messages that exist in the Flash.h()— Encodes a value for safe HTML output. Use in templates to prevent XSS:hasManyCheckBox()— Used as a shortcut to output the proper form elements for an association.hasManyRadioButton()— Used as a shortcut to output the proper form elements for an association.hAttr()— Encodes a value for safe use inside an HTML attribute.hiddenField()— Builds and returns a string containing a hidden field form control based on the supplied objectName and property.hiddenFieldTag()— Builds and returns a string containing a hidden field form control based on the supplied name.highlight()— Highlights the phrase(s) everywhere in the text if found by wrapping them inspantags.hourSelectTag()— Builds and returns a string containing oneselectform control for the hours of the day based on the suppliimageTag()— Returns animgtag.includeContent()— Used to output the content for a particular section in a layout.includedInObject()— Used as a shortcut to check if the specified IDs are a part of the main form object.includeLayout()— Includes the contents of another layout file.includePartial()— Includes the specified partial file in the view.javaScriptIncludeTag()— Returns ascripttag for a JavaScript file (or several) based on the supplied arguments.lastPageLink()— Creates a link to the last page, or a disabled span when already on the last page.linkTo()— Creates a link to another page in your application.mailTo()— Creates amailtolink tag to the specified email address, which is also used as the name of the link unlessminuteSelectTag()— Builds and returns a string containing oneselectform control for the minutes of an hour based on the suppmonthSelectTag()— Builds and returns a string containing aselectform control for the months of the year based on the supplinextPageLink()— Creates a link to the next page, or a disabled span when on the last page.numberField()— Builds and returns a string containing a number field form control based on the supplied objectName and property.numberFieldTag()— Builds and returns a string containing a number field form control based on the supplied name.pageNumberLinks()— Creates a windowed set of page number links around the current page.paginationInfo()— Displays a text summary of the current pagination state, e.g. “Showing 26-50 of 1,000 records”.paginationLinks()— Builds and returns a string containing links to pages based on a paginated query.paginationNav()— Creates a complete pagination navigation element wrapping individual pagination helpers.passwordField()— Builds and returns a string containing a password field form control based on the supplied objectName and property.passwordFieldTag()— Builds and returns a string containing a password field form control based on the supplied name.previousPageLink()— Creates a link to the previous page, or a disabled span when on the first page.radioButton()— Builds and returns a string containing a radio button form control based on the supplied objectName and property.radioButtonTag()— Builds and returns a string containing a radio button form control based on the supplied name.rangeField()— Builds and returns a string containing a range slider form control based on the supplied objectName and property.rangeFieldTag()— Builds and returns a string containing a range slider form control based on the supplied name.resetCycle()— Resets a cycle so that it starts from the first list value the next time it is called.searchField()— Builds and returns a string containing a search field form control based on the supplied objectName and property.searchFieldTag()— Builds and returns a string containing a search field form control based on the supplied name.secondSelectTag()— Builds and returns a string containing oneselectform control for the seconds of a minute based on the supselect()— Builds and returns a string containing a select form control based on the supplied objectName and property.selectTag()— Builds and returns a string containing a select form control based on the supplied name and options.simpleFormat()— Returns formatted text using HTML break tags () and HTML paragraph elements () basestartFormTag()— Builds and returns a string containing the openingformtag.stripLinks()— Removes all links from an HTML string, leaving just the link text.stripTags()— Removes all HTML tags from a string.styleSheetLinkTag()— Returns alinktag for a stylesheet (or several) based on the supplied arguments.submitTag()— Builds and returns a string containing a submit button form control.telField()— Builds and returns a string containing a telephone field form control based on the supplied objectName and property.telFieldTag()— Builds and returns a string containing a telephone field form control based on the supplied name.textArea()— Builds and returns a string containing a text area field form control based on the supplied objectName and property.textAreaTag()— Builds and returns a string containing a text area form control based on the supplied name.textField()— Builds and returns a string containing a text field form control based on the supplied objectName and property.textFieldTag()— Builds and returns a string containing a text field form control based on the supplied name.timeSelect()— Builds and returns a string containing threeselectform controls for hour, minute, and second based on thetimeSelectTags()— Builds and returns a string containing threeselectform controls for hour, minute, and second based on namurlField()— Builds and returns a string containing a URL field form control based on the supplied objectName and property.urlFieldTag()— Builds and returns a string containing a URL field form control based on the supplied name.viteAsset()— Returns the resolved URL for a Vite entrypoint. In production, reads the Vite manifestvitePreloadTag()— Returnstags for a Vite entrypoint and its transitiveviteScriptTag()— Returns ‘script’ tags for a Vite JS entrypoint. In development, also injects the ViteviteStyleTag()— Returns atag for a Vite CSS entrypoint. In development, Vite injects CSS viayearSelectTag()— Builds and returns a string containing aselectform control for a range of years based on the supplied nam