
dm-rest-adapter doesn't permit to customize URLs
Reported by Mauricio Eduardo Szabo | September 30th, 2009 @ 06:46 PM
The dm-rest-adapter doesn't seems to obey the storage_names property. So, if I create a class like:
class StudentRest
include DataMapper::Resource
property :id, Serial
property :name, String
storage_names[:default] = 'students'
end
a StudentRest.all tries to find a resource on http://localhost/student_rests.xml, because it tries to pluralize the class name (it seems to me that overriding the default storage_names, the adapter should be able to find http://localhost/students.xml)
I ended up solving this problem just by adding:
class DataMapperRest::Adapter
def resource_name(model)
model.storage_name
end end
After I setup connections.
Comments and changes to this ticket
-
Jonathan Stott (namelessjon) October 13th, 2009 @ 11:49 AM
- Assigned user set to Jonathan Stott (namelessjon)
- State changed from new to accepted
-
Dan Kubb (dkubb) October 14th, 2009 @ 01:57 PM
- State changed from accepted to resolved
(from [82f709d76279a261e723d32b7d7e7b4667f4b160]) [dm-rest-adapter] Now using model storage names
[#1067 state:resolved]
Previously, dm-rest-adapter used its own methods for determining the
model part of the URL, which meant that the standard ways of overriding
this name were not possible.
http://github.com/datamapper/dm-more/commit/82f709d76279a261e723d32...
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 »