#221 ✓resolved
Yaroslaff Fedin

Namespaced models break Query::Path

Reported by Yaroslaff Fedin | April 24th, 2008 @ 02:28 AM

So there's a syntax:

Namespace::Model.all(Namespace::Model.association => 1)

It relies on Resource#method_missin which executes this line:

DataMapper::Query::Path.new([ relationship ], method)

where method is caught method name (:association). Path then tries to classify it without namespace and raises "Constant not found".

The solution to this is to avoid passing method directly and take @parent_model_name from relationship itself (currently there's no setter).

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 25th, 2008 @ 03:57 AM

    • State changed from “new” to “open”

    The Relationship object should have a parent_model method that you can use instead of @parent_model_name. It will return the parent model class.

  • Guy van den Berg (guyvdb)

    Guy van den Berg (guyvdb) April 27th, 2008 @ 01:26 AM

    We cannot include the class in the model as two models that reference each other would cause a circular reference. I have done some work on this, but still need to complete it. We are simply ensuring that the model name is fully qualified. Additionally, I am going to append the module name of the model to the association model if the association does not have a module name space.

  • Bernerd Schaefer

    Bernerd Schaefer June 10th, 2008 @ 12:00 PM

    • State changed from “open” to “resolved”


    These specs pass, so it appears this has been resolved on edge.

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 »