flyerhzm/switch_user

Problem in controller_guard block

Closed this issue · 3 comments

config.controller_guard = lambda { |current_user, request| current_user.admin? || Rails.env.development? }

Gettin a nil exception on current_user

undefined method `admin?' for nil:NilClass

Just updated the version and started to fail.

@shuargan you need to define current_user in your controller and make sure it's not nil.

im using device, in my controllers is always define and never nil

but it does complain current_user is nil.