When you use rails generate scaffold admin/user --model-name=User
or rails generate scaffold_controller --model-name=User
it generates almost everything in a namespaced fashion. You get app/controllers/admin/users_controller.rb
with your controller and app/views/admin/users/
filled with your views.
The one thing it doesn't get right is your paths. You have to manually go and replace references to user_path
with admin_user_path
and the like. This is pretty tedious.
Is there a way to tell Rails to generate the paths to point to your new namespace, rather than the namespace that the model is in?
Using Rails 4.