Skip to content

Instantly share code, notes, and snippets.

@sandro
Created July 20, 2009 00:33
Show Gist options
  • Save sandro/150095 to your computer and use it in GitHub Desktop.
Save sandro/150095 to your computer and use it in GitHub Desktop.
should "allow deeply nested many associations" do
Address.class_eval do
many :people
end
person = Person.new :name => 'Meg'
address = Address.new :state => 'FL'
address.people << person
project = Project.new
project.addresses << address
project.save
from_db = Project.find project.id
from_db.addresses.first.state.should == 'FL'
from_db.addresses.first.people.first.name.should == 'Meg'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment