Skip to content

Instantly share code, notes, and snippets.

@leanucci
Created October 5, 2010 21:05
Show Gist options
  • Save leanucci/612336 to your computer and use it in GitHub Desktop.
Save leanucci/612336 to your computer and use it in GitHub Desktop.
## line 657, test/cases/nested_attribute_test.rb
def test_should_trigger_validations_on_new_nested_objects
repair_validations(Bird) do
Bird.validates_uniqueness_of(:name)
assert_no_difference ['Pirate.count', 'Bird.count'] do
Pirate.create(:catchphrase => "Garrr!", :birds_attributes => {"0" => {:name => "Garrr!Bird"}, "1" => {:name => "Garrr!Bird"}})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment