app/models/plan.rb
def deactivate!
    # If no other :creator, :administrator or :editor is attached
    # to the plan, then also deactivate all other active roles
    # and set the plan's visibility to :private
    if authors.empty?
      roles.where(active: true).update_all(active: false)
      self.visibility = Plan.visibilities[:privately_visible]
      save!
    else
      false
    end
  end
# Deactivates the plan (sets all roles to inactive and visibility to :private)
#
# Returns Boolean
Deactivates the plan (sets all roles to inactive and visibility to :private)
Returns Boolean
Deactivates the plan ( sets all roles to inactive and visibility to : private ) Returns Boolean
def deactivate!
    if authors.empty?
      roles.where(active: true).update_all(active: false)
      self.visibility = Plan.visibilities[:privately_visible]
      save!
    else
      false
    end
  end
def deactivate! if authors . empty? roles . where ( active : true ) . update_all ( active : false ) self . visibility = Plan . visibilities [ :privately_visible ] save! else false end end
Deactivates the plan (sets all roles to inactive and visibility to :private)
Returns Boolean
Deactivates the plan ( sets all roles to inactive and visibility to : private ) Returns Boolean
# If no other :creator, :administrator or :editor is attached # to the plan, then also deactivate all other active roles # and set the plan's visibility to :private