title: Form not displaying error messages for nested resource
body: <p>I am having trouble getting error messages to display when a user tries to submit a blank comment. Upon create failure it <code>render 'posts/show'</code> properly but it doesnt appear to be sending the <code>@comment</code> object that my error_messages partial expects. Any thoughts? </p>
  
  <p>comments_controller.rb:</p>
  
  <pre><code>  def create
      @post = Post.find(params[:post_id])
      @comment = @post.comments.build(comment_params)
      @comment.user = current_user
      if @comment.save
        flash[:success] = "Comment created!"
        redirect_to post_path(@post)
      else
        @comments = @post.comments.paginate(page: params[:page], :per_page =&gt; 5)
        render 'posts/show' # =&gt; Renders but does not display errors???
      end
    end
  </code></pre>
  
  <p>posts_controller.rb:</p>
  
  <pre><code>  def show
      @post = Post.find(params[:id])
      @comments = @post.comments.paginate(page: params[:page], :per_page =&gt; 5)
      @comment = @post.comments.build if signed_in?
    end
  </code></pre>
  
  <p>_comment_form.html.erb</p>
  
  <pre><code>&lt;%= form_for([@post, @post.comments.build], :html =&gt; { :role =&gt; "form" }) do |f| %&gt;
    &lt;%= render 'shared/error_messages', object: f.object %&gt;
    &lt;div class="form-group"&gt;
      &lt;%= f.label :content %&gt;
          &lt;%= f.text_area :content, class: "form-control", placeholder: "Enter new comment..." %&gt;
    &lt;/div&gt;
    &lt;div class="btn-group"&gt;
      &lt;%= f.submit "Post", class: "btn btn-large btn-primary" %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>