Class: UserDeletionReason
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- UserDeletionReason
- Defined in:
- app/models/user_deletion_reason.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.default_deletions ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/user_deletion_reason.rb', line 20 def self.default_deletions [ { title: 'account_deletion.title.have_another_account', skip_reason: true, reason_desc: nil }, { title: 'account_deletion.title.too_many_notifications', skip_reason: true, reason_desc: nil }, { title: 'account_deletion.title.sth_broken', skip_reason: false, reason_desc: 'account_deletion.reason_description.sth_broken' }, { title: 'account_deletion.title.other', skip_reason: false, reason_desc: 'account_deletion.reason_description.other' } ] end |
.generate_default_deletions ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/models/user_deletion_reason.rb', line 12 def self.generate_default_deletions default_deletions.each do |deletion_reason| record = UserDeletionReason.where(title: deletion_reason[:title]).first_or_initialize record.assign_attributes(deletion_reason) record.save end end |
Instance Method Details
#reason_desc_tran ⇒ Object
6 7 8 9 10 |
# File 'app/models/user_deletion_reason.rb', line 6 def reason_desc_tran return unless reason_desc? I18n.t(reason_desc) end |
#title_tran ⇒ Object
2 3 4 |
# File 'app/models/user_deletion_reason.rb', line 2 def title_tran I18n.t(title) end |