Im using rails 3.2 and am having trouble using pre-created devise alongside active admin using a single model and an HABTM relation to a Role model.
I've followed this tutorial http://jaysonlane.net/2012/04/rails-devise-and-active-admin-single-user-model
And have altered a few things such as
unless current_user.admin?
for
unless current_user.roles.first.id==1 #checks if its an admin or not
If I log in with a regular user and try to access admin page through :300/admin I get a "Permission denied", which is a good thing.
However, if I log with an admin account(it sucessfully logs as an admin), and go to :3000/admin, it displays and error:
NoMethodError in Admin/dashboard#index
undefined method for 'destroy_admin_user_session_path'
changing it to:
config.logout_link_path = :destroy_current_admin_user_session_path
or
config.logout_link_path = :destroy_current_user_session_path
won't help either.
Thanks you in advance for your help
Had to run rake routes
and alter the defaut active_admin initializer path and methods to my routes.
As for the error in logging out, apparently the default method for signing out with Active admin is :get. Therefore, an error occurs when clicking "Logout" in active admin. To fix this, go to config->initializers->active_admin.rb and add
config.logout_link_method= :delete
Hope this helps someone.
Thank you again @pjammer and @iain for your help in poiting me in the right direction. Regards
Had to run rake routes and alter the defaut active_admin initializer path and methods to my routes.
As for the error in logging out, apparently the default method for signing out with Active admin is :get. Therefore, an error occurs when clicking "Logout" in active admin. To fix this, go to config->initializers->active_admin.rb and add
config.logout_link_method= :delete Hope this helps someone.
Thank you again @pjammer and @iain for your help in poiting me in the right direction. Regards