Hi, just started reading http://guides.rubyonrails.org/getting_started.html and this code example: <%= form_for(@post) do |f| %> ... <div class="field"> <%= f.label :name %><br /> <%= f.text_field :name %> </div> <div class="field"> <%= f.label :title %><br /> <%= f.text_field :title %> </div> <div class="field"> <%= f.label :content %><br /> <%= f.text_area :content %> </div> <div class="actions"> <%= f.submit %> </div>
In case we need to show a field in several templates, we need to duplicate its type (text_field etc). The type belongs to the field, so why not remove this repetition by making a self-contained "field" like f.name, or f.label, or f.content, that would encompass rendering logic and would spit out proper form snippet: <%= f.name %> Then if someone wanted to override how a certain field is rendered, they could spell everything out as above. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

