I discovered an interesting issue with Controller#resource today:

  resource(Company.first, :teams)

works fine but

  resource(@team.company, :teams)

fails to find the route!

After some digging, I discovered the problem. To find the route,
#resource uses the object's class name as part of the route key.
Company.first is of class Company, and @team.company is of class
DataMapper::Associations::ManyToOne::Proxy. The interesting thing is
that calling inspect on each of them gives the same results, since
Proxy overrides #kind_of?, so this problem took me a while to find.

I suppose DataMapper::Associations::ManyToOne::Proxy should forward
#class as well, unless there is another solution anyone could propose.
Is there a different method that resource could be using to turn the
class into a key?
--~--~---------~--~----~------------~-------~--~----~
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