Created
May 24, 2011 06:09
-
-
Save nicotaing/988202 to your computer and use it in GitHub Desktop.
Simple association
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
#app/model/user.rb | |
class User < ActiveRecord::Base | |
#Du coup tu peux appeler @user.address => Objet Address instancie | |
:has_one :address | |
end | |
#app/model/address.rb | |
class Address < ActiveRecord::Base | |
#Du coup tu peux appeler @address.user => Objet User instancie | |
:belongs_to :address | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment