Last active
August 29, 2015 14:02
-
-
Save MilanGrubnic70/b1e14a5fc521785d3b51 to your computer and use it in GitHub Desktop.
Associations with Source
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 OrangeTree < AR::Base | |
has_many :oranges | |
has_many :seeds, through: :oranges, source: :seedlings | |
end | |
class Orange < AR::Base | |
belongs_to :orange_tree | |
has_many :seedlings, class_name: "Seed" | |
end | |
class Seed < AR::Base | |
belongs_to :orange | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment