jeudi 30 juillet 2015

How to have same routes with and without namespace - rails 4

So, i am making a custom admin panel in the admin namespace.

and i have a resources courses in it.

what i don't know is how can i have the same routes shared between the namespace and without the namespace

eg: localhost:3000/admin/courses & localhost:3000/courses

the controllers ok can be different

the thought is that its not really DRY paradigm if i have both resources for the same route

namespace admin do
   resources :courses
end

and just

resources :courses

Is there a way to have one resource and be shared between namespace and without namespace or the example above is the way to go?

Aucun commentaire:

Enregistrer un commentaire