Explanation: In my opinion, the decision to handle the logic in one controller as opposed to two comes down to what you consider to be the resource of interest. Normally, you would consider each model to represent a distinct resource and thus create a separate controller to handle actions related to each resource. However, when there are multiple deeply coupled models for which multiple actions (e.g. show, new, create) are handled in a single view, it might be cleaner to think of the models as forming a single resource.

In this example, I think of the resource as a collective one consisting of both the question and its answers. Since this collective resource is uniquely identified by the question itself, I would let the question controller handle it. The show action in the questions controller already involves retrieving the collective question-answers resource, so you might think of the answer action (and potentially unanswer and reanswer actions) as the analogue of update to that collective resource.

Thinking of the resources this way is largely a matter of design preference, and there will be trade-offs depending on the requirements.

I don't agree. The creation of an answer belong in AnswersController#create. Why is this justified according to you? It's not like it's impossible to render a specific template if there's an error.
–
MischaOct 14 '12 at 12:20

I agree with what cdesrosiers says since it feels pretty much natural for me too, I even had an answer_with method defined for my question model before posted this. Still just a matter of personal preference, of course. Another thing I like about this approach is that it allows you to simply use respond_with @question
–
Vlad KhomichOct 14 '12 at 20:25

Thanks for your elaborate explanation. I see what you mean now. Just like "update a question" you can "answer a question". Answer is a verb, not a noun.
–
MischaOct 15 '12 at 5:55

It's bad idea to use the flash for errors, besides you cannot repopulate the fields with this solution. Do you want to user to fill out the whole form again if an error occurs?
–
MischaOct 14 '12 at 12:23