Monday, 26 August 2013

Devise: NameError in ActiveAdmin::Devise::SessionsController#destroy

Devise: NameError in ActiveAdmin::Devise::SessionsController#destroy

I am getting this error :
NameError in ActiveAdmin::Devise::SessionsController#destroy
uninitialized constant AdminUser
Rails.root: /Users/ryanwieghard/code/flamingo-hours
when I click the following link in my app:
<%= link_to('Logout', destroy_user_session_path, :method => :delete) %>
I originally had devise registered with my a AdminUser class, but I
recently refactored it to User. Here is the original line in my routes.rb
devise_for :admin_users, ActiveAdmin::Devise.config
which is now:
devise_for :users, ActiveAdmin::Devise.config
I am running ActiveAdmin, and User is registered with it as well. Here is
the users.rb file in my admin directory.
ActiveAdmin.register User do
index do
column :email
column :current_sign_in_at
column :last_sign_in_at
column :sign_in_count
default_actions
end
filter :email
form do |f|
f.inputs "Admin Details" do
f.input :email
f.input :password
f.input :password_confirmation
end
f.actions
end
end
Here are my devise and activeadmin initializers.
active_admin.rb
ActiveAdmin.setup do |config|
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
#
config.site_title = "Flamingo Hours"
# Set the link url for the title. For example, to take
# users to your main site. Defaults to no link.
#
# config.site_title_link = "/"
# Set an optional image to be displayed for the header
# instead of a string (overrides :site_title)
#
# Note: Recommended image height is 21px to properly fit in the header
#
# config.site_title_image = "/images/logo.png"
# == Default Namespace
#
# Set the default namespace each administration resource
# will be added to.
#
# eg:
# config.default_name
#
# This will create resources in the HelloWorld module and
# will namespace routes to /hello_world/*
#
# To set no namespace by default, use:
# config.default_namespace = false
#
# Default:
# config.default_namespace = :admin
#
# You can customize the settings for each namespace by using
# a namespace block. For example, to change the site title
# within a namespace:
#
# config.namespace :admin do |admin|
# admin.site_title = "Custom Admin Title"
# end
#
# == Current User
#
# Active Admin will associate actions with the current
# user performing them.
#
# This setting changes the method which Active Admin calls
# to return the currently logged in user.
config.current_user_method = :current_user
config.logout_link_path = :destroy_user_session_path
config.logout_link_method = :delete
config.authorization_adapter = ActiveAdmin::CanCanAdapter
config.batch_actions = true
end
devise.rb Here is the other one.
Devise.setup do |config|
config.mailer_sender =
"please-change-me-at-config-initializers-devise@example.com"
require 'devise/orm/active_record'
# The same considerations mentioned for authentication_keys also apply
to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and
when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [ :email ]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default
is :email.
config.strip_whitespace_keys = [ :email ]
# By default Devise will store the user in session. You can skip storage
for
# :http_auth and :token_auth by adding those symbols to the array below.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing :skip => :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# Limiting the stretches to just one in testing will increase the
performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to
not use
# a value less than 10 in other environments.
config.stretches = Rails.env.test? ? 1 : 10
# If true, requires any email changes to be confirmed (exactly the same
way as
# initial account confirmation) to be applied. Requires additional
unconfirmed_email
# db field (see migrations). Until confirmed new email is stored in
# unconfirmed email column, and copied to email column on successful
confirmation.
config.reconfirmable = true
# ==> Configuration for :validatable
# Range for password length. Default is 8..128.
config.password_length = 8..128
config.reset_password_within = 6.hours
end
Please let me know if you need to post any more relevant information.
Thanks for your help!

No comments:

Post a Comment