Creating a search form

To create a search form, enter the following code

  • form_tag: This is the default helper for creating a form. It's first parameter, /search is the action and the second parameter specifies the HTTP method. For search forms, it is important to always use the method get
  • label_tag: This helper creates an html `` tag.
  • text_field_tag: This will create an input element with type text
  • submit_tag: This creates an input element with type submit

Originally published at .