Rails Nested Resources with :member
I've got something like this in my routes.rb:
map.resources :retailers, :has_one => [:invite_code]
map.resources :invite_codes, :member => {:redeem => :get}
开发者_Python百科and it isn't generating a route that I would expect:
http://localhost:3000/retailers/1/invite_code/redeem
Am I doing it wrong?
To nest resources, use a block like this:
map.resources :retailers do |r|
r.resource :invite_code, :member => { :redeem => :get }
end
精彩评论