This has been discussed before in the DM list. The associated object is
actually a Proxy. The workaround for now is to get the object from the db
directly just as you are doing. This was supposed to be fixed in the latest
DM release (by having Proxy override the class method), but I have not
checked to see if the patch made it in.

..tony..

On Sun, Dec 21, 2008 at 5:55 PM, glenc <[email protected]> wrote:

>
> I'm not sure if this is a DataMapper issue or a Merb issue.  I have
> two models - Project and Company.  Project has a belongs_to :company
> association.  Company has a "has n :projects" association.
>
> On the show view for a project, I want the associated company along
> with a link to that company's show action.
>
> Calling resource() with the associated object directly results in a
> Generation Error.  However, if I load the company recored fresh from
> the database, it works.
>
> Doesn't Work:
> <%= link_to @project.company.name, resource(@project.company) %>
>
> Works:
> <%= link_to @project.company.name, resource(Company.get
> (@project.company.id)) %>
>
> Do I need to do something different with my associations?  Is this a
> bug or am I just missing something?
>
> Thanks,
> Glen
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to