Topic: div_for, form_for parameters
I'm reading the book Beginning Rails 3. The app being built has users posting Articles and other users posting Comments to the Articles. An Article has_many Comments and a Comment belongs_to Article.
Now in the Article and Comment partials the beginning code looks like this:
<%= div_for article do %> <%= div_for comment do %>
I don't understand these two lines. First of all what does div_for do exactly? And secondly where do the variables 'article' and 'comment' come from?
My other question is regarding app/views/comments/new.html.erb. The code looks like this:
<%= form_for([@article, @article.comments.new]) do |f| %>
Can someone explain why these two variables are in there and what they do?