#559 invalid

Patch for fixing many-to-many assoc renaming not working

Reported by lobo_tuerto | September 10th, 2008 @ 02:48 AM

From 49ff5933ae158ae80ba8b601519237b0ccf4910f Mon Sep 17 00:00:00 2001 From: lobo_tuerto dev@lobotuerto.com Date: Wed, 10 Sep 2008 02:39:20 -0500 Subject: [PATCH] Fix for renamed many-to-many associations.

class IntrepidAuthor include DataMapper::Resource

property :id, Serial property :courage, Integer

has n, :restless_authors, :through => Resource end

class RestlessAuthor include DataMapper::Resource

property :id, Serial property :stamina, Integer

has n, :friends, :through => Resource, :class_name => 'IntrepidAuthor'#, :remote_name => :intrepid_authors # No more need for this. end

has n, :intrepid_authors, :through => Resource

has n, :friends, :through => Resource, :class_name => 'IntrepidAuthor'

has n, :friends, :through => Resource, :remote_name => :intrepid_authors, :class_name => 'IntrepidAuthor'

lib/dm-core/associations/many_to_many.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/dm-core/associations/many_to_many.rb b/lib/dm-core/associations/many_to_many.rb index 98651de..a430713 100644 --- a/lib/dm-core/associations/many_to_many.rb +++ b/lib/dm-core/associations/many_to_many.rb @@ -42,7 +42,7 @@ module DataMapper

     opts[:child_model]              ||= opts.delete(:class_name)  || Extlib::Inflection.classify(name)
     opts[:parent_model]             =   model
     opts[:repository_name]          =   repository_name

  •  opts[:remote_relationship_name] ||= opts.delete(:remote_name) || name
  •  opts[:remote_relationship_name] ||= opts.delete(:remote_name) || Extlib::Inflection.tableize(opts[:child_model])
     opts[:parent_key]               =   opts[:parent_key]
     opts[:child_key]                =   opts[:child_key]
     opts[:mutable]                  =   true

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

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 »

People watching this ticket