Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我尝试Create使用开拓者 gem 运行操作时,我收到此错误:
Create
NoMethodError: undefined method `has_key?' for nil:NilClass
问题是我没有将模型的名称作为传递给创建操作的哈希的根键。也就是说,我这样称呼它:
ModelClass::Create.run(some_attribute: 'attr', another_attribute: 'other_attr')
当我应该通过时:
ModelClass::Create.run(model_class: {some_attribute: 'attr', another_attribute: 'other_attr'})