On 06/26/2009 01:13 PM, Martin Gamsjaeger wrote: > Rupert > > Looking at dm-core next at > > http://github.com/datamapper/dm-core/blob/f1e711612cf1d77ce313d29d58d3537eb4a6c001/lib/dm-core/associations/relationship.rb#L9 > > it doesn't seem like :remote_name is a valid option anymore > (many_to_many.rb adds the :through option) > > dm-core/master mentions this concept at least in here > > http://github.com/datamapper/dm-core/blob/1a0edcdccba4d9540b42bbd2cc5ae239fbe1d296/lib/dm-core/associations/relationship_chain.rb#L5 > > I'd say file a bug, the workaround seems simple enough, but i liked > the old behavior more > > cheers > snusnu > > On Fri, Jun 26, 2009 at 20:39, roovo<[email protected]> wrote: > >> 2009/6/26 Roy Wright<[email protected]>: >> >>> On Jun 26, 2009, at 4:09 AM, roovo wrote: >>> >>> has n, :authors, User, :through => :author_joins >>> >>> >>> Take a look at: >>> http://datamapper.org/doku.php?id=docs:associations >>> >> Many thanks Roy >> >> Having looked through that it seems that the problem is that there is >> no longer any :remote_name option for the has association so it's not >> able to find the target in the join model. The way it works according >> to the help page is: >> >> has n, :authors, User, :through => :author_joins, :remote_name => >> :user, :child_key => [:paper_id] >> >> but this gives the same error :( >> >> I've found I can work around it by changing the association in the join >> model: >> >> class AuthorJoin >> include DataMapper::Resource >> >> property :id, Serial >> property :user_id, Integer >> property :paper_id, Integer >> >> belongs_to :author, :model => "User" >> belongs_to :paper >> end >> >> So I guess the question is, is the :remote_name omission a bug which I >> should file a ticket for or should this situation be handled in the >> way I've done it (or a better way I've not thought of)? >> >> Cheers and thanks again >>
I've found many-many problematic too with related table class account ... has n :locations, :through => :account_locations has n :account_locations class location ..... has n :accounts, :through => :account_locations has n :account_locations class account_locations ... property account_id property location_id belongs_to :account belongs_to :location with this class setup <%= @account.areas %> shows as nil even when the data is there worked in active record but is datamapper structured different ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
