I need to build a url inside a 开发者_高级运维controller for a nested resource:
http://0.0.0.0:3000/account/1/address/new
I could do: new_account_address_path(@account) but I'm inside the controller that has the account id on the context (params[:id]) I don't want to load the object from the db just to build the url.
What would be the best way to extend the rails helpers to to this: new_account_address_path(params[:id]) and have the http://0.0.0.0:3000/account/1/address/new ?
I also dont want to create a dummy instance.
You should be able to pass the route arguments as a hash:
new_account_address_path(:account_id => params[:account_id])
精彩评论