
DataMapper::Resource default_repository_name order issue
Reported by Ivan Judson | August 11th, 2009 @ 11:30 AM
Using dm-core, dm-more, do-* and extlib from the next branch on github. Up to date as of this morning.
When creating a model object the
def self.default_repository_name
:repo end
has to come before any property definitions or Model.all won't actually find any and with return an error.
Here's a model I've used to test this (just define a :legacy repo)
this works
class Archive
include DataMapper::Resource
def self.default_repository_name
:legacy
end
property :archive_id, Serial property :archive_name, String, :nullable => false property :archive_info, String, :nullable => false property :archive_url, String, :nullable => false
end
this doesn't
class Archive
include DataMapper::Resource
property :archive_id, Serial property :archive_name, String, :nullable => false property :archive_info, String, :nullable => false property :archive_url, String, :nullable => false
def self.default_repository_name
:legacy
end
end
Comments and changes to this ticket
-
Dan Kubb (dkubb) October 7th, 2009 @ 12:44 PM
- Milestone set to 0.10.2
- State changed from new to accepted
- Assigned user set to Dan Kubb (dkubb)
-
Dan Kubb (dkubb) November 10th, 2009 @ 02:44 AM
- State changed from accepted to suggestion
- Milestone cleared.
The reason for this is is that when the Property objects are declared, they are assigned to a model and a specific repository. If the repository is set after this happens, then it's too late.
In the future this may change, but for now it is going to be a requirement for defining models.
Marking this ticket as a suggestion to review later.
-
Dan Kubb (dkubb) November 10th, 2009 @ 02:44 AM
- Assigned user cleared.
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 »