before adding users
This commit is contained in:
@@ -9,14 +9,17 @@ class Employer < ApplicationRecord
|
||||
scope :inactive, -> { where(active: false) }
|
||||
|
||||
before_save :create_slug, if: :will_save_change_to_name?
|
||||
before_save :deactivation_check, if: :will_save_change_to_active?
|
||||
before_save :active_initialized_check, if: :will_save_change_to_active?
|
||||
|
||||
|
||||
def create_slug
|
||||
self.slug = Employer.employer_trim_name(name).parameterize
|
||||
end
|
||||
|
||||
def deactivation_check
|
||||
def active_initialized_check
|
||||
if active
|
||||
self.initialized = true
|
||||
end
|
||||
if active == false
|
||||
id_card_setup&.update(active: false)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user