Class: Lcms::Engine::User
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Lcms::Engine::User
- Defined in:
- app/models/lcms/engine/user.rb
Instance Method Summary collapse
Instance Method Details
#full_name ⇒ Object
19 20 21 22 23 24 |
# File 'app/models/lcms/engine/user.rb', line 19 def full_name [ survey&.fetch('first_name', nil), survey&.fetch('last_name', nil) ].reject(&:blank?).join(' ') end |
#generate_password ⇒ Object
26 27 28 29 30 |
# File 'app/models/lcms/engine/user.rb', line 26 def generate_password pwd = Devise.friendly_token.first(20) self.password = pwd self.password_confirmation = pwd end |
#name ⇒ Object
32 33 34 |
# File 'app/models/lcms/engine/user.rb', line 32 def name super.presence || full_name end |
#ready_to_go? ⇒ Boolean
36 37 38 |
# File 'app/models/lcms/engine/user.rb', line 36 def ready_to_go? admin? || survey.present? end |