Module: Pageflow::UserMixin
- Extended by:
- ActiveSupport::Concern
- Includes:
- Suspendable
- Defined in:
- lib/pageflow/user_mixin.rb
Overview
ActiveRecord related functionality of the Pageflow users.
Instance Method Summary
collapse
#active_for_authentication?, #suspend!, #suspended?, #unsuspend!
Instance Method Details
#admin? ⇒ Boolean
31
32
33
|
# File 'lib/pageflow/user_mixin.rb', line 31
def admin?
admin
end
|
#destroy_with_password(password) ⇒ Object
57
58
59
60
61
62
63
64
65
|
# File 'lib/pageflow/user_mixin.rb', line 57
def destroy_with_password(password)
if valid_password?(password)
destroy
true
else
errors.add(:current_password, password.blank? ? :blank : :invalid)
false
end
end
|
39
40
41
|
# File 'lib/pageflow/user_mixin.rb', line 39
def formal_name
[last_name, first_name] * ', '
end
|
#full_name ⇒ Object
35
36
37
|
# File 'lib/pageflow/user_mixin.rb', line 35
def full_name
[first_name, last_name] * ' '
end
|
#locale ⇒ Object
43
44
45
|
# File 'lib/pageflow/user_mixin.rb', line 43
def locale
super.presence || I18n.default_locale
end
|
#send_devise_notification(notification, *args) ⇒ Object
Configure devise to send emails using ActiveJob.
68
69
70
|
# File 'lib/pageflow/user_mixin.rb', line 68
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
|
#update_with_password(attributes) ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/pageflow/user_mixin.rb', line 47
def update_with_password(attributes)
if needs_password?(attributes)
super(attributes)
else
update_without_password(attributes.except(:current_password))
end
end
|