Skip to content

Instantly share code, notes, and snippets.

@tarot
Created October 30, 2015 14:40
Show Gist options
  • Save tarot/1613de2482d7a98d7cb9 to your computer and use it in GitHub Desktop.
Save tarot/1613de2482d7a98d7cb9 to your computer and use it in GitHub Desktop.
class Parent < ActiveRecord::Base
# t.string name
has_many :children
end
class Child < ActiveRecord::Base
# t.integer parent_id
# t.boolean hide_parent
belongs_to :parent
def parent_name
hide_parent ? nil : parent.name
end
end
@tarot
Copy link
Author

tarot commented Oct 30, 2015

こういうモデルがあるときにChild.all.includes(:parent)すると
Bullet::Notification::UnoptimizedQueryError Unused Eager Loading detected
になる気がする

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment