Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you run "rake routes" with your setup you'll see this:</p> <pre><code> account_campaigns GET /advertiser_accounts/:account_id/campaigns(.:format) campaigns#index POST /advertiser_accounts/:account_id/campaigns(.:format) campaigns#create new_account_campaign GET /advertiser_accounts/:account_id/campaigns/new(.:format) campaigns#new edit_account_campaign GET /advertiser_accounts/:account_id/campaigns/:id/edit(.:format) campaigns#edit account_campaign GET /advertiser_accounts/:account_id/campaigns/:id(.:format) campaigns#show PUT /advertiser_accounts/:account_id/campaigns/:id(.:format) campaigns#update DELETE /advertiser_accounts/:account_id/campaigns/:id(.:format) campaigns#destroy accounts GET /advertiser_accounts(.:format) advertiser_accounts#index POST /advertiser_accounts(.:format) advertiser_accounts#create new_account GET /advertiser_accounts/new(.:format) advertiser_accounts#new edit_account GET /advertiser_accounts/:id/edit(.:format) advertiser_accounts#edit account GET /advertiser_accounts/:id(.:format) advertiser_accounts#show PUT /advertiser_accounts/:id(.:format) advertiser_accounts#update DELETE /advertiser_accounts/:id(.:format) advertiser_accounts#destroy </code></pre> <p>So you should use "account_campaingns_path" in this setup, the ":as" actually changes the calls in the code not the paths in the url. If you want to change the paths you should use ":path =>" rather than ":as =>". </p> <p>The <a href="http://guides.rubyonrails.org/routing.html" rel="nofollow">Rails guide on routing</a> also shows some examples with ":as" and ":path" and the resulting paths and helpers, you'll need to search a bit because think they only use in in examples explaining other cases.</p> <p>Edit: rereading your question, I think you may also want to look at <a href="http://guides.rubyonrails.org/routing.html#adding-more-restful-actions" rel="nofollow">member routes</a>, I'm not sure if that's what you want to mean with it being a single inheritance and not wanting to pass the advertiser_account's ':account_id'?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload