models: entry, comment
I want to add comments to an entry in my forum on the same page where the entry and all belonging comments are listed.
-
What is the railsway of doing this?
-
How can I render the “new” template of “comments” on my “show” page of “entries”?
I tried:
<% render :template => {:controller => 'comments', :action => 'new'} %>as well as
form_for
For #2, try pulling out the new comments form into a partial and then rendering that in both the comments/new view and the entries/show view. So both of those would have a line something like:
As of the past few Rails releases (I don’t remember exactly when this was added), you can just do:
I would also ask yourself if there’s any reason to have a separate comments/new page in the first place: will it ever make sense to add a comment that’s not in the context of some entry?