This project is archived and is in readonly mode.

naming problem in nested singular resource
Reported by Jan De Poorter | February 9th, 2010 @ 03:00 PM | in 3.0.2
When nesting singular resources the naming is off. Instead of having resource1_resource2_path, I just get resource2_path method for the route.
In Rails 2.3 syntax
map.resource :account do |acc|
 acc.resource :payment_plan
end
Which results in
 new_account_payment_plan GET    /account/payment_plan/new(.:format)                        {:controller=>"payment_plans", :action=>"new"}
edit_account_payment_plan GET    /account/payment_plan/edit(.:format)                       {:controller=>"payment_plans", :action=>"edit"}
     account_payment_plan GET    /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"show"}
                          PUT    /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"update"}
                          DELETE /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"destroy"}
                          POST   /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"create"}
Rails 3 syntax
resource :account do
  resource :payment_plan
end
which results in
                          GET    /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"show"}
                          POST   /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"create"}
                          PUT    /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"update"}
             payment_plan DELETE /account/payment_plan(.:format)                            {:controller=>"payment_plans", :action=>"destroy"}
         new_payment_plan GET    /account/payment_plan/new(.:format)                        {:controller=>"payment_plans", :action=>"new"}
        edit_payment_plan GET    /account/payment_plan/edit(.:format)                       {:controller=>"payment_plans", :action=>"edit"}
Comments and changes to this ticket
- 
            
         
- 
         Prem Sichanugrist (sikachu) February 12th, 2010 @ 10:59 AM- State changed from new to open
- Milestone cleared.
 I've found this bug too. Will try to apply the bug later today. Will get back to you soon :) 
- 
         Repository March 7th, 2010 @ 10:37 PM- State changed from open to committed
 (from [dfc7ff64298e1a0656639a630cc0ddbf93c1eeb9]) Make sure nested singular resources get the correct name [#3911 state:committed] Signed-off-by: Jeremy Kemper jeremy@bitsweat.net 
 http://github.com/rails/rails/commit/dfc7ff64298e1a0656639a630cc0dd...
- 
         Jeremy Kemper October 15th, 2010 @ 11:01 PM- Milestone set to 3.0.2
- Importance changed from  to Low
 
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 
         3911 
          naming problem in nested singular resource
        [#3911 state:committed] 3911 
          naming problem in nested singular resource
        [#3911 state:committed]
 Jan De Poorter
      Jan De Poorter
 Prem Sichanugrist (sikachu)
      Prem Sichanugrist (sikachu)