activeadmin


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

Related Links

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

Categories

HOME
livecode
windows-10
initialization
facebook-android-sdk
mithril.js
pyresttest
wine
watch-os-3
amazon-emr
pm2
fullcalendar-scheduler
outlook-restapi
sonicwall
vmware-workstation
mixpanel
gmp
sqlplus
environment
jpa-2.1
beego
python-imageio
macromedia
npoi
premake
quick-nimble
fotorama
shapeless
cmis
restful-architecture
android-canvas
char-pointer
ftp-server
twilio-php
reset
sbjson
plane
oauth2-playground
opal-framework
latexml
asihttprequest
icecast
ilrepack
redisson
node-apn
sigsegv
subforms
scala-collections
kendo-editor
polymaps
pecl
zend-server
ogg
metabase
streamwriter
bilinear-interpolation
perforce-integrate
ajaxmin
maximize
gravatar
taco
jsr363
juniper-network-connect
abstract-factory
incron
mobile-country-code
nidaqmx
angular-ui-select
box2dweb
accessory
nachos
stripe.net
boinc
microformats
jbox2d
donut-chart
reentrancy
xmlwriter
multiscaleimage
xcode4.5
msinfo32
taskkill
pcspim
multidrop-bus
litespeed
will-paginate
cewolf
solandra
zend-test
dm
index.dat
watchpoint

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App