Closed arabakevin closed 2 years ago
When I use a where on a model with polymorphic association i have an error
where
Inbox::Row.where( item: context.sub_item, module: 0, organization: context.organization, project: context.project ).first
In my model
belongs_to :item, polymorphic: true
i have this error
rails_1 | NoMethodError (undefined method `id' for nil:NilClass): rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/document/association/belongs_to.rb:103:in `cast_attr' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/document/association.rb:27:in `association_user_to_model_cast' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:200:in `cast_key_path' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:96:in `simplify' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:48:in `map' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:48:in `simplify' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:48:in `map' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:48:in `simplify' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:19:in `merge_where_ast' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/core.rb:39:in `call' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/core.rb:39:in `block in merge!' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/core.rb:36:in `each' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/core.rb:36:in `merge!' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/eager_load.rb:16:in `merge!' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/cache.rb:24:in `merge!' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/extend.rb:15:in `merge!' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/core.rb:45:in `merge' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/core.rb:56:in `chain' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/criteria/where.rb:11:in `where' rails_1 | /usr/local/bundle/gems/nobrainer-0.43.0/lib/no_brainer/document/criteria.rb:16:in `where'
When I use a
where
on a model with polymorphic association i have an errorIn my model
i have this error