Tôi muốn biết cách để người dùng hiện tại đăng nhập qua GUI quản trị hoạt động?Làm cách nào để người dùng hiện tại đăng nhập qua quản trị viên đang hoạt động?
Trang chủ: http://www.activeadmin.info/
Cảm ơn trước
MODEL
admin_user.rb
class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :id , :admin_permission
# attr_accessible :title, :body
has_one :admin_permission
validates_uniqueness_of :email
def self.current_logged_user
# ?
end
end
CẬP NHẬT
Khi tôi cố gắng sử dụng phương thức 'current_user' trong bảng điều khiển.rb hoặc bất kỳ tệp liên quan đến quản trị viên hiện hoạt nào, có vẻ như nó không được triển khai.
OUTPUT
undefined local variable or method `current_user' for
Cảm ơn. Nó hoạt động! Ví dụ: logger.debug "Người dùng quản trị hiện tại: # {current_admin_user.email}" – ipegasus