actmd / abraham

Trackable application tours for Rails with i18n support
MIT License
124 stars 45 forks source link

Where to specify current_user ? #61

Closed netpenthe closed 2 years ago

netpenthe commented 3 years ago

I use a different table for Devise.

Where do I configure this?

prschmid commented 3 years ago

Hello @netpenthe. There are several different ways that you can do this, but the simplest is to just define an alias method.

alias_method 'current_user`, `current_foo`

where current_foo is the method that is available to you via Devise. You'll want to change that to whatever your actual function is. I'm not sure how you have setup your Rails project, but you can add this to your ApplicationController or whatever base class you use for authenticated controllers.

Alternatively, you can just define a method called current_user that calls your Devise method. E.g.

def current_user
  current_foo
end

Again, here we're assuming that current_foo is the name of the function Devise provides.

Hope that helps!