Method: Devise::Models::Lockable#lock_access!
- Defined in:
- lib/devise/models/lockable.rb
#lock_access!(opts = { }) ⇒ Object
Lock a user setting its locked_at to actual time.
-
opts: Hash options if you don’t want to send email when you lock access, you could pass the next hash ‘{ send_instructions: false } as option`.
42 43 44 45 46 47 48 49 50 |
# File 'lib/devise/models/lockable.rb', line 42 def lock_access!(opts = { }) self.locked_at = Time.now.utc if unlock_strategy_enabled?(:email) && opts.fetch(:send_instructions, true) send_unlock_instructions else save(validate: false) end end |