I’m looking for a way to have a contact form in the application layout and show it on all pages.
Ideally i’d like to just do a
form_for @contact_us
I’ve tried creating the instance variable in the application controller but it doesnt seem to be in scope when the layout loads..
(does the layout load before the result of the action??)
I guess id settle for a form_tag.
Whats the ususal way of doing this kinda thing?
Thanks!
You can use a partial. Put the form code (use form_tag) in the partial and render the partial in the layout.
More about partials here.