Rails , HAML and form_tag
When using HAML as the template language in Ruby on Rails , don't forget the do
This won't work (even though in the docs it saids it will)
=form_tag(controller: :search , action: :query)
.search_field
=text_field_tag :q
=button_tag 'Go' , class: 'search-button' , type: :submit
Instead you will need to do
=form_tag(controller: :search , action: :query) do
.search_field
=text_field_tag :q
=button_tag 'Go' , class: 'search-button' , type: :submit
Otherwise the HAML Parse fails :(
Written by Martin Haynes
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#