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.
CreateTrailblazer 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'})