devise-guests: undefined method `_run_logging_in_user_callbacks'

I’m using this gem on a project and have run into a problem.

I’m using Pundit, and after following their suggestion for passing a user into the config (https://github.com/elabs/pundit#customize-pundit-user) I’m now getting the following error the current_or_guest_user method is called via it:

undefined method `_run_logging_in_user_callbacks'

I think something weird is happening in the gem to cause this error.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I’ve come across this just now too. Conveniently after we put something into prod… Bad form it’s been open this long, but whatever, have got a solution that works for us.

I’ve just defined the current_or_guest_user method directly on my ApplicationController like so:

def current_or_guest_user
    if current_user
      session[:guest_user_id] = nil if session[:guest_user_id]
      current_user
    else
      guest_user
    end
  end

Due to FK contraints the guest user deletion was never working for us anyway, that’s a task for another day.