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