diff options
| author | jpl | 2016-09-02 11:34:35 +0200 | 
|---|---|---|
| committer | jpl | 2016-09-02 11:34:48 +0200 | 
| commit | 3f7531ddfa0d0c0e359d87baffa7097c9ee44d1a (patch) | |
| tree | 630500074ce26a8b7ffdfe742f291400f3934b3b /app/models | |
| parent | d54645efac3c60cca069888e72d47d52646c6f20 (diff) | |
| download | chouette-core-3f7531ddfa0d0c0e359d87baffa7097c9ee44d1a.tar.bz2 | |
Refs #1523: adding (un)archive actions to referentials
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/referential.rb | 22 | 
1 files changed, 10 insertions, 12 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb index 51168a55f..d4bdc8374 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -208,20 +208,18 @@ class Referential < ActiveRecord::Base      GeoRuby::SimpleFeatures::Geometry.from_ewkt(bounds.present? ? bounds : default_bounds ).envelope    end +  # Archive    def archived? -    true if !archived_at.nil? +    archived_at != nil    end -  alias_method :archived, :archived? -  def archived=(state) -    state = [true, "1"].include?(state) -    self.archived_at = (state ? Time.now : nil) +  def archive! +    # self.archived = true +    touch :archived_at    end - -  def archive -    self.archived = true -  end -  def unarchive -    self.archived = false +  def unarchive! +    # self.archived = false +    update_column :archived_at, nil    end -end +   +end
\ No newline at end of file  | 
