search for: new_charge_path

Displaying 1 result from an estimated 1 matches for "new_charge_path".

2008 Dec 02
0
Optional parameter in nested routes
...this helper: new_company_charge_path(@company) For a company object, it generates a path like /companies//32/charges/new For a nil object, it generates a path like /companies//charges/new, but I get an routing error (No route matches...). I don''t want to use an if in my view to use either new_charge_path or new_company_charge_path. I reckon that /companies//charges/new can be parseable and rails can recognize the path. Any ideas? map.resources :charges map.resources :companies do |company| company.resources :charges end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------...