Hello,
I’m following the tutorial at http://guides.rubyonrails.org/getting_started.html. I got to the point where adding new posts should be functional (the end of 5.7). When I try to submit a post, I receive the error stating “Can’t convert Symbol into String”. The trace shows:
app/controllers/posts_controller.rb:16:in `post_params'
app/controllers/posts_controller.rb:6:in `create'
This error occurred while loading the following files:
post
The code in my posts_controller.rb file is:
class PostsController < ApplicationController
def new
end
def create
@post = Post.new(params[:post].permit(:title, :text))
@post.save
redirect_to @post
end
def show
@post = Post.find(params[:id])
end
private
def post_params
params.require(:post).permit(:title, :text)
end
end