I have this in my routes.rb
scope '/admin' do
root :to => 'home#index'
resources :posts do
scope :information, :controller => 'information' do
match 'description'
end
end
end
This give me
post_description /admin/posts/:post_id/description(.:format) {:action=>"description", :controller=>"information"}
It leads to the controller that i want, though i need to have information in my url like this:
/admin/posts/:post_id/information/description(.:format)
I have tried using namespace instead but that need a mapstructure information/information
How should i accomplish what i want, which route strategy should i use?
I’ve read Rails routing guides 2 times, and still I’m not able to figure it out.
Thanks.
What about this:
[EDIT]
More REST-like: The REST/resourceful thing to do would be to build resources that would deliver the information. So the resource
informationwould give all info on GET. If the description is the actual resource you are getting, then it should beposts/:id/description. If a description is a resource linked to information, then indeed your path is as specified. Now what we do in that case is build our resource more Atom-like, with links to the related items. E.g.When building REST-API we consider it a smell if the urls get very long and nested-nested-nested. Providing the links also allow for exploration of the API.
Not sure if that helps.