max bröker
max bröker

Reputation: 21

undefined method `params_require' - New into rails

I try to code a small blog in rails and when I tried to save a post through the website i get an Error. I can create a post with the console but thats not the goal.

this is my code for the create method:

  def create
@post = Post.new(post_params)

     if post.save
         redirect_to post.path
     else
         render "new"
  end


end

  def post_params
    params_require(:post).permit(:title, :content)
  end

would be nice if someone can help me. Thanks

Upvotes: 0

Views: 116

Answers (1)

ashvin
ashvin

Reputation: 2040

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

Change params_require to params.require

Upvotes: 6

Related Questions