Results 1 to 4 of 4
Nov 29, 2007, 08:18 #1
- Join Date
- May 2007
- 0 Post(s)
- 0 Thread(s)
Combining Rails controllers in one view
I'd like to let people add comments to an article and I'd like the comment entry field and save button — as well as previous comments — to appear on the same page as the article itself.
I've got an Article model and a Comment model. Article has_many Comments and Comment belongs_to Article. Article is RESTful; not sure about Comment yet.
In my ArticleController "show" action, I believe I'll need to put some of the same code as I would put in the Comment "new" action. That way, I've got a new comment instantiated in case a user decides to add a comment.
Is there a best practice for this sort of thing -- or a tutorial? Any suggestions?