Created
November 13, 2013 15:10
-
-
Save kelso/7450618 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| has_many :relationships | |
| has_many :people, through: :relationships |
This file contains hidden or 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
| # stredovy model, ktory patri pod obidve - Person aj Account | |
| belongs_to :person | |
| belongs_to :account |
This file contains hidden or 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
| has_many :ownerships | |
| has_many :accounts, through: :ownerships |
This file contains hidden or 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
| # pouzitie | |
| account = Account.find(1) | |
| person = account.people.build(email: "x", password: "y") | |
| person.save | |
| # alebo z druhej strany | |
| person = People.find(1) | |
| account = person.accounts.build(company: "z") | |
| account.save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment