]> git.openstreetmap.org Git - rails.git/blob - app/models/concerns/redactable.rb
Merge remote-tracking branch 'upstream/pull/4178'
[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