When I try to run a Create
operation with the trailblazer gem, I get this error:
NoMethodError: undefined method `has_key?' for nil:NilClass
When I try to run a Create
operation with the trailblazer gem, I get this error:
NoMethodError: undefined method `has_key?' for nil:NilClass
The problem was I wasn't including the name of the model as the root key for the hash being passed to the create operation. That is, I was calling it like this:
ModelClass::Create.run(some_attribute: 'attr', another_attribute: 'other_attr')
when I should have been passing:
ModelClass::Create.run(model_class: {some_attribute: 'attr', another_attribute: 'other_attr'})