openstreetmap-website/app/models/concerns/redactable.rb
2020-06-03 16:44:26 +02:00

20 lines
386 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 is_latest_version?
# make the change
self.redaction = redaction
save!
end
end