I'm currently using Devise for user authentication and I would like to implement a backend admin to control the creation of users in the admin panel.
I have generated an admin controller and I've added a namespace to my routes.
-> routes.rb
namespace :admin do
resources :users
end
When I rake routes I get the following
admin_users GET /admin/users(.:format) admin/users#index
POST /admin/users(.:format) admin/users#create
new_admin_user GET /admin/users/new(.:format) admin/users#new
edit_admin_user GET /admin/users/:id/edit(.:format) admin/users#edit
admin_user GET /admin/users/:id(.:format) admin/users#show
PUT /admin/users/:id(.:format) admin/users#update
DELETE /admin/users/:id(.:format) admin/users#destroy
Which is what we want right? Now my question is, what is the naming convention for the functions in the admin controller?
How do I name my functions so they correspond to the following paths? I place the functions in the user controller or the admin?
I'm getting a routing error
uninitialized constant Admin
I don't think I've gotten the hang of routing just yet. Any additional resources would also be much appreciated.
I've been looking at http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing with not much success though. Thanks a lot!