ActiveModel::ForbiddenAttributesError - Rails 4

后端 未结 1 975
盖世英雄少女心
盖世英雄少女心 2021-02-13 15:30

I\'m a bit lost. I an getting the Rails 4 error: ActiveModel::ForbiddenAttributesError. I understand that this means I need to permit items to pass, which I have done, but I mu

相关标签:
1条回答
  • 2021-02-13 15:51

    Instead of

    @comment = @post.comments.create!(params[:comment])
    

    you want

    @comment = @post.comments.create!(comment_params)
    

    You did all the hard work without using the permitted attributes!

    0 讨论(0)
提交回复
热议问题