0

Here, I tried to fetch the current logged in User/Admin in the app but failed to see logged in user.

Model: Administrator

In Event model, trying to store who created the event by fetching loggedin-user in model before_create method.

Tried current, params, user_signed_in?, admin_signed_in, admin_signed_in?, admin, current_administrator, current_admin, current_user, current_user?, super, admin, user,, user_logged_in, user_logged

Got error every time ie NameError Exception: undefined local variable or method

Rubyist
  • 6,486
  • 10
  • 51
  • 86

1 Answers1

0

You are trying to access controller helpers, https://github.com/heartcombo/devise#controller-filters-and-helpers.

You can try to use current attributess or the idea of it i.e. "thread-isolated attributes singleton" to get current_user in models.

Haad
  • 1