Error_messages_for and seperate controllers

I’ve got two controllers, let’s call one Post and the other Comment
for simplicity, i.e.:

class Post < ApplicationController
def show

end
end

class Comment < ApplicationController
def create
@comment
end
end

In my create() method I would like to redirect back to the show method
after I have saved the comment. But If I have errors in saving the
comment, how am I to display this with error_messages_for in my
template? I would still like to redirect in this case, and not just
display the template in create(). Is there someway to pass the error
messages for @comment back to show method? Or to pass the @comment
variable back to the show method? Calling render :action => show
from the create method also does not seem to solve this problem.

Any sugguestions?

Appreciating all the help. Thanks so much,

Scott T.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs