HowTo: Assign a Class to a Rails Form · 101 words posted 07/15/2006 09:37 AM
This isn’t rocket science, but the syntax confused me so I’m getting this into google. To assign a css class to a form using Rails ActionView::Helpers::FormTagHelper and start_form_tag, use the following code, where f-wrap-1 is your form’s CSS class:
start_form_tag({:action => 'create'},{:class => 'f-wrap-1'})
If you need to assign the class to an update form and pass your object’s ID via the URL, do it this way:
start_form_tag({:action => 'update', :id=> @post}, {:class => 'f-wrap-1'})
Thanks to the Textdrive forum members for helping me sort this out.
* * *

