Redirecting to another controller in Rails
        Posted  
        
            by Vitaly
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Vitaly
        
        
        
        Published on 2010-04-13T18:02:32Z
        Indexed on 
            2010/04/13
            18:33 UTC
        
        
        Read the original article
        Hit count: 297
        
Hi,
I'm trying to redirect from one controller to another in Rails and I am getting this error:
undefined method `call' for nil:NilClass
The code is pretty simple (in def create method):
@blog_post_comment = BlogPostComment.new(params[:blog_post_comment])
respond_to do |format|
  if @blog_post_comment.save
    flash[:notice] = 'Comment was successfully created.'
    redirect_to(@blog_post_comment.blog_post)
  else
    render :action => "new"
  end
end
Save goes ok, the value gets into the database. How can I work around the redirect fail?
© Stack Overflow or respective owner