Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override active_for_authentication? for devise

Where do I put this to override active_for_authentication?

def active_for_authentication?
  super && account_active?
end

1) Location of file and file name.

2) what the full file would look like.. with, etc... class something < < devise:something

The original active_for_authentication? method can be found in devise/lib/devise/models/authenticatable.rb.

thank you

like image 423
user2012677 Avatar asked Apr 07 '13 17:04

user2012677


1 Answers

Overwrite the active_for_authentication? method in your model [...] — Source

Thus, if you have a User model you just need to do

class User

  def active_for_authentication?
    super && account_active?
  end

end
like image 150
Luís Ramalho Avatar answered Nov 09 '22 17:11

Luís Ramalho