in my rails blog app i get this error message when trying to submit the form for a new post:
ActionController::InvalidAuthenticityToken in PostsController#create ActionController::InvalidAuthenticityToken Extracted source (around line #211):
def handle_unverified_request
raise ActionController::InvalidAuthenticityToken
end
end
end
this is my posts_controller.rb file:
class PostsController < ApplicationController
def index
end
def new
end
def create
@post=Post.new(post_params)
@post.save
redirect_to @post
end
def show
@show=Post.find(params[:id])
end
private
def post_params
params.require(:post).permit(:title,:body)
end
end
this is my form code:
<font color="#BD004B"><h1>New Post<br></h1></font>
<%=form_for :post, url: posts_path do |f|%>
<p>
<%=f.label :title%><br>
<%=f.text_field :title%>
</p>
<p>
<%=f.label :body%><br>
<%=f.text_area :body%>
</p>
<p>
<%=f.submit%>
</p>
<%end%>