简体   繁体   中英

Rails routes to show action on custom route

I am trying to add a customer action to one of my resources, therefore I created a custom route:

namespace :admin do
  resources :subscriptions

  match 'subscriptions/summary', :to => 'subscriptions#summary', :as => 'subscriptions_summary'

end

In my rake routes I'm getting the following output:

admin_subscriptions_summary        /admin/subscriptions/summary(.:format)                               spree/admin/subscriptions#summary

The problem now is, whenever I try to create a link to the summary action, I get following error:

Missing template spree/admin/subscriptions/show

Why is my app confusing the show action with the summary action?

namespace :admin do
  resources :subscriptions do
    collection do 
      get 'summary'
    end
  end
end

solved it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM