I have following models:
preference.rb
class Preference < ApplicationRecord
has_many :preferences_ingredients, dependent: :destroy
has_many :prohibited_ingredients, through: :preferences_ingredients, source: :ingredient
ingredient
class Ingredient < ApplicationRecord
belongs_to :category, class_name: :IngredientCategory
has_many :preferences_ingredients, dependent: :destroy
has_many :preferences, through: :preferences_ingredients
And when Im trying to create preference with prohibited_ingredient_ids:
input = { prohibited_ingredient_ids: ['e6a3b97f-c783-4a1d-8dcd-f3b88059fd6b'], ... }
object_class.create!(input)
I got bullet error:
Bullet::Notification::UnoptimizedQueryError:
user: ruslan
POST /preferences
USE eager loading detected
Ingredient => [:category]
Add to your query: .includes([:category])
Can anyone help me to understand what am I doing wrong, and how to fix this, please?