Created
June 24, 2009 15:54
-
-
Save miry/135350 to your computer and use it in GitHub Desktop.
Create several associations at once
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 User < ActiveRecord::Base | |
has_many :cars | |
end | |
class Car < ActiveRecord::Base | |
belongs_to :user | |
end | |
User.first.cars.build([{}, {}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment