]> git.openstreetmap.org Git - rails.git/blob - app/models/concerns/redactable.rb
Merge pull request #3486 from tomhughes/vips
[rails.git] / app / models / concerns / redactable.rb
1 module Redactable
2   extend ActiveSupport::Concern
3
4   included do
5     scope :unredacted, -> { where(:redaction_id => nil) }
6   end
7
8   def redacted?
9     !redaction.nil?
10   end
11
12   def redact!(redaction)
13     # check that this version isn't the current version
14     raise OSM::APICannotRedactError if latest_version?
15
16     # make the change
17     self.redaction = redaction
18     save!
19   end
20 end