Skip to content

Instantly share code, notes, and snippets.

@jacquescrocker
Created April 27, 2010 03:57
Show Gist options
  • Save jacquescrocker/380316 to your computer and use it in GitHub Desktop.
Save jacquescrocker/380316 to your computer and use it in GitHub Desktop.
context "when :allow_destroy is enabled" do
before do
@person = Person.new
@person.favorites.build(:title => "Ice Cream")
@person.favorites.build(:title => "Jello")
@attributes = {
"0" => { "title" => "Jello", "_destroy" => "true" }
}
@person.favorites_attributes = @attributes
end
it "updates the existing attributes on the association" do
@person.favorites.size.should == 1
@person.favorites.first.title == "Ice Cream"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment