--- title: Rails form helpers layout: default --- ### Forms # Model: form_for @post do |f| form_for @post, url: { method: 'put', action: 'create' }, html: { class: 'nifty_form' } do |f| f.label :first_name f.text_field :first_name field :multiselect, f, :first_name ### Stuff f.object ### Fields f.check_box :is_admin f.text_field :title f.text_area :body, size: '60x12' f.label :post, :title f.label :post, :title, "Title" f.label :post, :title, "Title", class: "title" f.label(:post, :terms) { "Accept terms" } #=> radio_button("post", "category", "rails") radio_button("post", "category", "java") #=> ### Select dropdowns f.time_zone_select :time_zone f.date_select :birthday f.select :city_id, [['Lisbon',1], ['Madrid',2], ...], 4 # (4 = selected) f.collection_select :city_id, City.all, :id, :name options_for_select [['Lisbon',1], ['Madrid', 2], ...], 4 # Just makes