views:

67

answers:

2

I've got something like this in my routes.rb:

map.resources :retailers, :has_one => [:invite_code]
map.resources :invite_codes, :member => {:redeem => :get}

and it isn't generating a route that I would expect:

http://localhost:3000/retailers/1/invite_code/redeem

Am I doing it wrong?

+5  A: 

To nest resources, use a block like this:

map.resources :retailers do |r|
  r.resource :invite_code, :member => { :redeem => :get }
end
mckeed
A: 

Try this link may that help.

http://smartic.us/2007/04/26/rails-edge-now-has_many-or-has_one-resources/

Salil