Created
November 21, 2008 14:24
-
-
Save semanticart/27439 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 Child | |
belongs_to :master, :polymorphic => true | |
end | |
class HumanParent | |
has_many :organs | |
end | |
class RobotOverlord | |
has_many :spark_plugs | |
has_many :power_supplies | |
end | |
# i want each included master to eager-load their hm relationships, but this | |
# fails since HumanParent doesn't have spark_plugs, etc. | |
Child.all(:include => {:master, [:organs, :spark_plugs, :power_supplies]}) | |
# as an epilogue, you can accomplish what I wanted to do by hacking activerecord | |
# to not raise the exception. It is super-easy to do (just see the stacktrace when | |
# you try to do this and remove that line), but I ended up approaching the problem | |
# from the other direction and not needing a hacky solution. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment