It's for preventing cross site request forgery: www.writesoftwarewell.com/how-rails-authenticity-tokens-protect-against-csrf/#:~:text=These%20cryptic%20values%20are%20called,time%20the%20session%20is%20regenerated.
Hello sir.. I'm trying to create comment section in my app.. I have model named comment_post.. When I'm trying to save comment I'm getting following error param is missing or the value is empty: comment_post In the line second line of function def comment_post_params params. require(:comment_post). permit(:body) end I tried removing require(:comment_post) part.. But then my parameters are nil.. Can you please help me regarding this
We could, but I prefer to keep the routes as shallow as possible and don’t feel like seeing the user and it’s ID in the path has any extra value, at least for this use case.
Nice! Your videos are on of the best. Thanks for taking the time to do them
Thanks for watching!
what is the authenticity token you added in the form? what video did you explain it in, thanks
It's for preventing cross site request forgery: www.writesoftwarewell.com/how-rails-authenticity-tokens-protect-against-csrf/#:~:text=These%20cryptic%20values%20are%20called,time%20the%20session%20is%20regenerated.
CJ, how can I add a key binding to vs code for the type html form skeleton that you have?
Trust me I have tried my technical sophistication skills.
I messed up somewhere. I'm using blog (for posts) & blog_comments (for comments), and my form action is
but it's not finding it.
Hello sir.. I'm trying to create comment section in my app.. I have model named comment_post.. When I'm trying to save comment I'm getting following error
param is missing or the value is empty: comment_post
In the line second line of function
def comment_post_params
params. require(:comment_post). permit(:body)
end
I tried removing require(:comment_post) part.. But then my parameters are nil..
Can you please help me regarding this
Why aren't you wrapping the post resources in the user like
Resources user do
Resources post
End
We could, but I prefer to keep the routes as shallow as possible and don’t feel like seeing the user and it’s ID in the path has any extra value, at least for this use case.
@@cjav_dev could you do a video specifically on routes? They confuse me a lot. I thought you had to nest then to show ownership
Would you be so kind and direct me how to delete these comments? Thanks
Ah. So Comment.find(comment_id).destroy should work for an individual and Comment.destroy_all should delete all
@@cjav_dev I don't get it, I don't know how could I make a delete button to a comment
genial