You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def update
@post = Post.find(params[:id])
@post.update(params.require(:post))
redirect_to post_path(@post)
end
It gives me this error:
1) form shows an update form that submits content and redirects and prints out params
Failure/Error: @post.update(params.require(:post))
ActiveModel::ForbiddenAttributesError:
ActiveModel::ForbiddenAttributesError
What worked for me:
def update
@post = Post.find(params[:id])
@post.update(params.require(:post).permit!)
redirect_to post_path(@post)
end
I also don't understand why the routes aren't written in this ReadMe. If it's a ReadMe and it's not teaching routes, they should be written so we can focus on the material being taught. It's distracting.
The text was updated successfully, but these errors were encountered:
Current code:
It gives me this error:
What worked for me:
I also don't understand why the routes aren't written in this ReadMe. If it's a ReadMe and it's not teaching routes, they should be written so we can focus on the material being taught. It's distracting.
The text was updated successfully, but these errors were encountered: