openstreetmap-website/app/models/concerns/redactable.rb
2022-03-03 22:47:55 +00:00

20 lines
383 B
Ruby

module Redactable
extend ActiveSupport::Concern
included do
scope :unredacted, -> { where(:redaction_id => nil) }
end
def redacted?
!redaction.nil?
end
def redact!(redaction)
# check that this version isn't the current version
raise OSM::APICannotRedactError if latest_version?
# make the change
self.redaction = redaction
save!
end
end