I'm having difficulty understanding this syntax:
usually, I see it as:Code:<%= form_for([@post, @post.comments.build]) do |f| %>
what's with the extra stuff? what does @post.comments.build do? Things to note: posts is related to comments... as in posts has many comments and a comment belongs to a post. Igot this code for this tutorial:Code:<%= form_for @post do |f| %>
http://guides.rubyonrails.org/getting_started.html
Code:<h2>Add a comment:</h2> <%= form_for([@post, @post.comments.build]) do |f| %> <div class="field"> <%= f.label :commenter %><br /> <%= f.text_field :commenter %> </div> <div class="field"> <%= f.label :body %><br /> <%= f.text_area :body %> </div> <div class="actions"> <%= f.submit %> </div> <% end %>




Bookmarks