[Rails] Controller syntax
why is this required:
def new
@post = Post.find(params[:post_id])
@comment = @post.comments.build
end
instead of:
def new
@comment = Post.find(params[:post_id]).comments.build
end
is the 2nd style possible? If no, why not?
if yes, why is the 1st style preferred?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home