Created
May 28, 2012 19:35
-
-
Save chanks/2820828 to your computer and use it in GitHub Desktop.
Sequel nested attributes spec
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
it "should support creating new objects with composite primary keys" do | |
a = @Artist.new({:name=>'Ar', :concerts_attributes=>[{:tour => 'To', :date => "2004-04-05"}]}) | |
@db.sqls.should == [] | |
a.save | |
check_sql_array("INSERT INTO artists (name) VALUES ('Ar')", | |
["INSERT INTO concerts (tour, date, artist_id) VALUES ('To', '2004-04-05', 1)", | |
"INSERT INTO concerts (artist_id, tour, date) VALUES (1, 'To', '2004-04-05')" | |
]) # etc. | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment