I have an admin area for clients which works great!
namespace :admin do
root to: "base#clients"
resources :clients
end
I want to have the index and show actions from the app/controllers/clients_controller.rb to also work for non-admins and keep all of the admin CRUD as it is now but with the above routes I am getting an error No route matches [GET] "/clients" as I would have expected because I moved the routes into the admin namespace.
My question is how do I expose my non-namespace admin actions to non-admins and still maintain the admin namespace actions in my routes above?
-J
Just add
resources :clients, :only => [:index, :show]outside of the:adminnamespace. See http://guides.rubyonrails.org/routing.html#restricting-the-routes-created for more options.You can always inspect the created routes when you enter
rake routesin your terminal.