Displaying 1 result from an estimated 1 matches for "new_company_charge_path".
2008 Dec 02
0
Optional parameter in nested routes
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_charg...