10 - form_for @post do |f|
13 Field names will be prefixed with `post` (the class name), and values will be derived from this object (eg, `f.text_field :name` from `@post.name`).
19 url: { method: 'put', action: 'create' }, |
20 html: { class: 'nifty_form' } |
30 f.text_area :body, size: '60x12'
36 f.check_box :remember_me
37 f.label :remember_me, "Remember me"
43 f.radio_button :gender, 'male'
44 f.label :gender_male, "Male"
46 f.radio_button :gender, 'female'
47 f.label :gender_female, "Female"
54 f.label :title, "Title"
55 f.label :title, "Title", class: "title"
56 f.label(:post, :terms) { "Accept terms" }
82 = form_for @post do |f|
83 = fields_for :author, @post.author do |ff|
90 f.select :city_id, [['Lisbon',1], ['Madrid',2], ...], 4
93 options_for_select [['Lisbon',1], ['Madrid',2], ...], 4
94 # Just makes <option> tags
100 f.collection_radio_buttons :author_id, Author.all, :id, :name_with_initial
101 f.collection_select :city_id, City.all, :id, :name
102 # (field, collection, value_key, label_key)
108 f.time_zone_select :time_zone
109 f.date_select :birthday
116 # helpers.submit.<action>
117 create: "Create a %{model}"
118 update: "Confirm changes to %{model}"
120 # helpers.submit.<model>.<action>
122 create: "Publish article"
123 update: "Update article"
125 # helpers.label.<model>.<field>
128 body: "Your body text"
134 radio_button("post", "category", "rails")
135 radio_button("post", "category", "java")
137 # picks from @post.category
138 # <input type="radio" id="post_category_rails" name="post[category]"
139 # value="rails" checked="checked" />
145 select(method, choices = nil, options = {}, html_options = {}, &block)
146 choices == [ ['label', id], ... ]
148 submit(value=nil, options={})