Module: Workarea::Release::Activation
- Extended by:
- ActiveSupport::Concern
- Included in:
- Workarea::Releasable
- Defined in:
- app/models/workarea/release/activation.rb
Instance Method Summary collapse
- #activate_with? ⇒ Boolean
- #create_activation_changeset(release_id) ⇒ Object
- #save_activate_with ⇒ Object
- #was_active? ⇒ Boolean
Instance Method Details
#activate_with? ⇒ Boolean
17 18 19 |
# File 'app/models/workarea/release/activation.rb', line 17 def activate_with? activate_with.present? && BSON::ObjectId.legal?(activate_with) end |
#create_activation_changeset(release_id) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/models/workarea/release/activation.rb', line 21 def create_activation_changeset(release_id) set = changesets.find_or_initialize_by(release_id: release_id) set.document_path = document_path set.changeset = if Workarea.config.localized_active_fields { 'active' => { I18n.locale.to_s => true } } else { 'active' => true } end set.original = if Workarea.config.localized_active_fields { 'active' => { I18n.locale.to_s => false } } else { 'active' => false } end set.save! end |
#save_activate_with ⇒ Object
11 12 13 14 15 |
# File 'app/models/workarea/release/activation.rb', line 11 def save_activate_with self.active = false if activate_with? yield create_activation_changeset(activate_with) if activate_with? end |