Module: Central::Support::UserConcern::Callbacks
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/central/support/concerns/user_concern/callbacks.rb
Instance Method Summary collapse
Instance Method Details
#remove_story_association ⇒ Object
30 31 32 33 34 |
# File 'lib/central/support/concerns/user_concern/callbacks.rb', line 30 def remove_story_association Story.where(requested_by_id: id).update_all(requested_by_id: nil, requested_by_name: nil) Story.where(owned_by_id: id).update_all(owned_by_id: nil, owned_by_name: nil) Membership.where(user_id: id).delete_all end |
#set_random_password_if_blank ⇒ Object
17 18 19 20 21 |
# File 'lib/central/support/concerns/user_concern/callbacks.rb', line 17 def set_random_password_if_blank if new_record? && self.password.blank? && self.password_confirmation.blank? self.password = self.password_confirmation = Digest::SHA1.hexdigest("--#{Time.current.to_s}--#{email}--")[0,8] end end |
#set_team ⇒ Object
23 24 25 26 27 28 |
# File 'lib/central/support/concerns/user_concern/callbacks.rb', line 23 def set_team if team_slug team = Team.not_archived.find_by_slug(team_slug) self.enrollments.create(team: team) if team end end |