Posted By

chrisaiv on 10/29/08


Tagged

rails Blocks formbuilder


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

webstic
octoberborn
tof


Rails: Basic form_for Helper


 / Published in: Rails
 

formfor is the most popular helper used when generating a form that binds to one type of object. The parameter you pass through formfor ("|f|") is of datatype FormBuilder which offers these methods: textfield, passwordfield, checkbox, and textarea

  1. <% form_for @story do |f| %>
  2. <p>
  3. name:<br />
  4. <%= f.text_field :name %>
  5. </p>
  6. <p>
  7. link:<br />
  8. <%= f.text_field :link %>
  9. </p>
  10. <p>
  11. <%= submit_tag %>
  12. </p>
  13. <% end %>

Report this snippet  

You need to login to post a comment.