Changeset [045b9074617820dc4f19bd7c2466b05303898f3e] by Piotr Solnica

January 12th, 2011 @ 07:25 AM

Support changing value of a foreign key in m:1 relationship

This makes possible to explicitly update a foreign key, for example:

john = User.create jane = User.create

post = Post.create :user => john post.update :user_id => jane.id # that used to not work

Additionally it makes a child resource to update its parent if an FK was changed:

post.user_id = john.id post.user # and it's john again

[#1471 state:resolved] https://github.com/datamapper/dm-core/commit/045b9074617820dc4f19bd...

Committed by Piotr Solnica

  • M lib/dm-core/associations/many_to_one.rb
  • M lib/dm-core/resource.rb
  • M spec/public/model/relationship_spec.rb
  • M spec/public/resource_spec.rb
New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »