All my charges belong to a company. On the new charge form, sometimes I specify a company, sometimes I don''t because I don''t know the company beforehand in all cases. So, sometimes the @company object is nil. I''m using 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/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---