未知操作无法为PostsController找到操作'create'

时间:2015-08-09 12:38:21

标签: ruby-on-rails ruby-on-rails-4

class PostsController < ApplicationController
  def index
  end
  def new
  end
  def Create
    @post = Post.new(post_params)
    @post.save

    redirect_to @post, :notice=> "created"
  end

  private
  def post_params
    params.require(:post).permit(:title, :body)
  end
end

1 个答案:

答案 0 :(得分:0)

您需要将您的方法设为小写。将Create更改为create