undefined method `destroy_user_session_path' for active admin with cancancan and sorcery
HI I am working on rails 4.2.4 app and i am using sorcery for authentication, cancancan for authorization.. so far so good i can login and users can do as well .... I am trying to add activeadmin for admin dashboard I so far set up almost everything but when i fire up the link http://localhost:3000/admin when logged in the app as admin i get the error : undefined method `destroy_user_session_path' for :ActiveAdmin::Views::TabbedNavigation here are my modules: Activeadmin.rb ActiveAdmin.setup do |config| config.site_title = "title goes here" def authenticate_user! if !current_user.admin? redirect_to new_user_session_path end end config.authentication_method = :authenticate_user! config.current_user_method = :current_user config.logout_link_method = :delete config.logout_link_path = :destroy_user_session_path config.batch_actions = true config.authorization_adapter = ActiveAdmin::CanCanAdapter config.localize_format = :long end ability.rb class Ability include CanCan::Ability def initialize(user) user ||= User.new if user.admin? can :read, ActiveAdmin::Page, :name => "Dashboard" can :manage, :all elsif user.client? can :manage, [Act, Do, Fact, Task, T] cannot :read, ActiveAdmin::Page, :name => "Dashboard" else can :read, Activity end can :manage, UserSessionsController do |user_session| user == user_session end if user.active? can :time, Activity can :read, ActiveAdmin::Page, :name => "Dashboard" end can :log_in, User can :log_out, User can :reset_password, User end end destroy in sessions controller def destroy authorize! :log_out, User logout redirect_to root_url, notice: I18n.t('users.log_out') end Can anyone point me on how to solve this .... been stuck here for a while ... cheers
so after investigating further the correct way is config.logout_link_path = :user_session_path But sadly ActiveAdmin don't support urls with ids at logout path at the moment. see this thread from the activeadmin owner
ActiveAdmin won't save has many and belongs to many field
Truncate data in ActiveAdmin index page
Active Admin: how to set filter label dynamically
How to add an HTML-class to an ActiveAdmin index table
How to use modules to split very long code in active admin?
Downloading all records of a paginated resource in ActiveAdmin
Can you use the Form() command in ActiveAdmin in the content of a custom page?
CollectionAction route being skipped, action treated as ID
Possible to “split” an ActiveAdmin resource between multiple menu items?
Rails: activeadmin, undefined method `per' for #<ActiveRecord::Relation:0x4d15ee0>
Active Admin create form in register_page
ActiveAdmin - how to customize edit action?
ActiveAdmin - Filter with default value
Make semantic_errors render the exact error-message
ActiveAdmin - Custom action with reusing the show form
make checkboxes for a has_many :through association using Formtastic