vendredi 31 juillet 2015

How to limit concerns in routing to certain actions for root but not for namespace - Rails 4

So lets consider the following in routes.rb

  concern :shared_actions do
    resources :courses do
      resources :lessons
    end
    resources :users
  end

my admin namespace has the following

  namespace :admin do
    concerns :shared_actions
    get '', to:'dashboard#index', as: '/'
    resources :lessons
  end

and my root path '/' also shares the same concerns using

concerns :shared_actions

So what i want is,for the root path i want only index and show action for the courses path but in the admin namespace i want to have all actions for courses.

Is there a way to do that without writing explicit code for each case?

Aucun commentaire:

Enregistrer un commentaire