开发者

Rails Nested Resources with :member

开发者 https://www.devze.com 2022-12-27 08:00 出处:网络
I\'ve got something like this in my routes.rb: map.resources :retailers, :has_one => [:invite_code]

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
0

精彩评论

暂无评论...
验证码 换一张
取 消