Shape assistants are especially useful to allow rails to process shapes based on your model. To give an example API documentation:
Following code
<% form_for :person, @person, :url => { :action => "create" } do |f| %> <%= f.text_field :first_name %> <%= f.text_field :last_name %> <%= submit_tag 'Create' %> <% end %>
generates this html
<form action="/persons/create" method="post"> <input id="person_first_name" name="person[first_name]" size="30" type="text" /> <input id="person_last_name" name="person[last_name]" size="30" type="text" /> <input name="commit" type="submit" value="Create" /> </form>
You can write html yourself, but with the help of the form helpers you have to enter less and make the form creation less dependent on the implementation of the rails. You always get a form that writes data to your model when you click the submit button. If rails developers ever change the implementation of this, you automatically get the correct html output from your helpers. If you wrote html manually, you will have to update all this to reflect changes in the internal operation of the rails.
Sebastian diet
source share