-
-
Save tarot/1613de2482d7a98d7cb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
こういうモデルがあるときに
Child.all.includes(:parent)
するとBullet::Notification::UnoptimizedQueryError Unused Eager Loading detected
になる気がする