Displaying 1 result from an estimated 1 matches for "collection_path".
Did you mean:
collection_date
2008 Oct 09
0
How to consume a nested singular resource?
...3000/"
end
class Blog < ActiveResource::Base
self.site = "http://localhost:3001/users/:user_id/"
end
CRUD operations for the User model work fine. No problem there. But on
inspection of the collection and element paths for the Blog model the
following urls are generated:
Blog.collection_path(:user_id => 1)
=> "/users/1/blogs.xml"
Blog.element_path(1, :user_id => 1)
=> "/users/1/blogs/1.xml"
On trying to create a blog for a specific user:
b = Blog.new(:params => {:user_id => 1})
>> b.save
ActiveResource::ResourceNotFound: Failed with 404 No...