Forgive the title of the question; spent 20 minutes trying to write something coherent (doubtful if succeeded).
Anyways, using a blog as an example, our models look like this:
Post hasMany Comment Comment belongsTo Post
Let's say I want to add a new comment: when saving the comment, I need to include the foreign key to the parent Post (Post.id) in the data array before calling save.
Because I want to keep the relationship in context to the user -- I don't want them to have to choose a post from a select field to associate the comment with -- here's two options I see:
1) Put the comment form in the Post's view.
2) pass the Post Id as an argument (via GET) to the Comment.add action (or write/read to/from Session); save and redirect back to the parent Post.view.
Option 1 is great for a blog, but not for a User's Profile, which could be too long of a form to include in the User view neatly.
Option 2 works I guess, but I'd have to write some Post-specific display/redirect conditionals to the Comments.add action, and it doesn't seem right; from what I've read, I should be trying to maintain a 1:1 relationship between controllers and models.
Is #2 acceptable as a Web MVC best practice? or is there another option I'm overlooking?