title: Unknown Action: The action 'create' could not be found for CommentsController
body: <p>I'm working on an app that allows users to comment on a single "work" (think blog post). The associations in the models are as follows:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :works  
    has_many :comments
  
  class Work &lt; ActiveRecord::Base
    belongs_to :user
    has_many :comments
  
  
  class Comment &lt; ActiveRecord::Base
    belongs_to :user
    belongs_to :post
    belongs_to :work
  </code></pre>
  
  <p>There's a form on the Works show page that allows users to post a comment:</p>
  
  <pre><code>&lt;%= form_for(@comment) do |f| %&gt;
    &lt;%= render 'shared/error_messages', object: f.object %&gt;
    &lt;div class="field"&gt;
      &lt;%= f.text_area :content, placeholder: "Post a comment!" %&gt;
    &lt;/div&gt;
    &lt;%= f.submit "Post", class: "btn btn-small btn-primary" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>The Works controller is as follows. Note that I'm adding the build comment functionality here so that the form on the Works page functions:</p>
  
  <pre><code>class WorksController &lt; ApplicationController
     #before_filter :current_user,   only: [:edit, :update]
  
    def index
      @works = Work.all
      @comment = @work.comments.build(params[:comment])
      @comment.user = current_user
  
  respond_to do |format|
    format.html # index.html.erb
    format.xml  { render :xml =&gt; @works }
  end
  end
  def create
      @work = current_user.works.create(params[:work])
      redirect_to current_user
    end
  
  def edit
      @work = current_user.works.find(params[:id])
  end
  
  def new
    @work = current_user.works.new
  end
  
  def destroy
    @work = current_user.works.find(params[:id]).destroy
    flash[:success] = "Work deleted"
    redirect_to current_user
  end
  
   def update
      @work = current_user.works.find(params[:id])
      if @work.update_attributes(params[:work])
        flash[:success] = "Profile updated"
        redirect_to @work
      else
        render 'edit'
      end
    end
  
  
    def show 
    @work = Work.find(params[:id])
    @comment = @work.comments.build
    @comment.user = current_user
    @activities = PublicActivity::Activity.order("created_at DESC").where(trackable_type: "Work", trackable_id: @work).all
    @comments = @work.comments.order("created_at DESC").where(work_id: @work ).all 
      respond_to do |format|
        format.html # show.html.erb
        format.xml  { render :xml =&gt; @work }
      end
    end
  end
  </code></pre>
  
  <p>And lastly, here is the Comments controller:</p>
  
  <pre><code>class CommentsController &lt; ApplicationController
  
    before_filter :authenticate_user!
  
    def index
      @comments = Comment.all
    end
  
    def show
      @comment = Comment.find(params[:id])
      @activities = PublicActivity::Activity.order("created_at DESC").where(trackable_type: "Comment", trackable_id: @comment).all
     respond_to do |format|
        format.html # show.html.erb
        format.xml  { render :xml =&gt; @comment }
    end
  
    def update
       @comment = current_user.comments.find(params[:id])
      if @comment.update_attributes(params[:comment])
        flash[:success] = "Comment updated"
        redirect_to @comment
      end
    end
  
    def create
      @work = Work.find(params[:id])
      @comment = @work.comments.build(params[:comment])
      @comment.user = current_user
      if @comment.save
        #flash[:success] = "Post created!"
        redirect_to @work
      else
        render 'home#index'
      end
    end
    end
  end
  </code></pre>
  
  <p>When I attempt to submit a comment using the comment form on the works show view page, I get the following error:</p>
  
  <p><strong>Unknown action
  The action 'create' could not be found for CommentsController</strong></p>
  
  <p>Why can't it find the create action on the Comments controller? Any help would be greatly appreciated.</p>
  
  <p>Thanks!</p>