Rails 4 Controller Test “Undefined Method Permit”

前端 未结 1 554
小蘑菇
小蘑菇 2021-01-03 01:42

I have a simple controller test based on the Rails 4 docs (using Test::Unit):

test \"should create user\" do
  assert_difference(\'User.count\') do
    post          


        
相关标签:
1条回答
  • 2021-01-03 02:03

    It seems like the data that is being POSTed to your create route is just a string, instead of a hash of attributes. What does users(:sample_user) return? Is it just an ID, or maybe an ActiveRecord object that is not being serialized correctly? If it's AR, maybe you need to send users(:sample_user).attributes as the payload?

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