
DataMapper::Associations::ManyToOne::Proxy#class is not being forwarded to parent.
Reported by David Dai | October 31st, 2008 @ 01:29 AM
When using belongs_to association, the instance method #class is not being forwarded to the parent object. This is currently breaking Merb's resource() helper method since resource() uses object.class.to_s to key into its routes. For example, given a association where an article belongs to its author: resource(article.author) will always lead to a missing route. This is due to article.author.class is returning DataMapper::Associations::ManyToOne::Proxy instead of the expected Author. I've attached a patch with the appropriate spec as requested by Dan Kubb. Thanks Dan, for all your help.
Comments and changes to this ticket
-
Joseph November 22nd, 2008 @ 06:00 PM
I just ran into this exact problem. I applied the patch and it does work.
-
Dan Kubb (dkubb) November 30th, 2008 @ 01:36 AM
- Assigned user changed from Sam Smoot to Dan Kubb (dkubb)
- State changed from new to resolved
Thanks alot! Patch applied in http://github.com/sam/dm-core/co...
Marking as resolved.
-
Dan Kubb (dkubb) September 1st, 2009 @ 02:14 AM
(from [63c50c45545c0d7e94189c2e45789ff0c3d48ebf]) Updated ManyToOne::Proxy to delegate #class to parent
- Fixes issue with Merb resource() helper method not being able to figure out route using ManyToOne::Proxy object.
[#628 state:resolved] http://github.com/datamapper/dm-core/commit/63c50c45545c0d7e94189c2...
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.
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
Attachments
Referenced by
-
628 DataMapper::Associations::ManyToOne::Proxy#class is not being forwarded to parent. [#628 state:resolved] http://github.com/datamapper/dm-co...