12 Oct, 2009
How to add a class to the form_for tag in Ruby on Rails
Posted by: Amir Sahib In: Code| Programming| Web Development
I’ve searched for a while and couldn’t figure this out until I actually picked up my book and browsed the source of examples. I’ll get straight to the code:
<% form_for :user, :url => users_path,:html => { :class => ’standard-form’ } do |f| -%>
That produces:
<form class=”standard-form” method=”post” action=”/users”>
As you can see I added a class [...]