Skip to content

Instantly share code, notes, and snippets.

@lalala
Created October 19, 2011 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lalala/1298072 to your computer and use it in GitHub Desktop.
Save lalala/1298072 to your computer and use it in GitHub Desktop.
resources :users do
member do
resources :goals
end
end
=====================================================
this gives
=====================================================
goals GET /users/:id/goals(.:format) {:action=>"index", :controller=>"goals"}
POST /users/:id/goals(.:format) {:action=>"create", :controller=>"goals"}
new_goal GET /users/:id/goals/new(.:format) {:action=>"new", :controller=>"goals"}
edit_goal GET /users/:id/goals/:id/edit(.:format) {:action=>"edit", :controller=>"goals"}
goal GET /users/:id/goals/:id(.:format) {:action=>"show", :controller=>"goals"}
PUT /users/:id/goals/:id(.:format) {:action=>"update", :controller=>"goals"}
DELETE /users/:id/goals/:id(.:format) {:action=>"destroy", :controller=>"goals"}
====================================================
How can I change the first :id to :user_id so i get e.g. params[:user_id] instead of just one :id in params? :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment