From 0a33c66146f14e3f49dac74eff9468578a5776c0 Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 3 Jun 2020 16:44:26 +0200 Subject: [PATCH] Convert lib files to model concerns --- .../models/concerns}/consistency_validations.rb | 2 ++ {lib => app/models/concerns}/redactable.rb | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) rename {lib => app/models/concerns}/consistency_validations.rb (98%) rename {lib => app/models/concerns}/redactable.rb (57%) diff --git a/lib/consistency_validations.rb b/app/models/concerns/consistency_validations.rb similarity index 98% rename from lib/consistency_validations.rb rename to app/models/concerns/consistency_validations.rb index 7e9b33586..00c6ce993 100644 --- a/lib/consistency_validations.rb +++ b/app/models/concerns/consistency_validations.rb @@ -1,4 +1,6 @@ module ConsistencyValidations + extend ActiveSupport::Concern + # Generic checks that are run for the updates and deletes of # node, ways and relations. This code is here to avoid duplication, # and allow the extention of the checks without having to modify the diff --git a/lib/redactable.rb b/app/models/concerns/redactable.rb similarity index 57% rename from lib/redactable.rb rename to app/models/concerns/redactable.rb index 6efdae0ef..ccf04907f 100644 --- a/lib/redactable.rb +++ b/app/models/concerns/redactable.rb @@ -1,10 +1,8 @@ -require "osm" - module Redactable - def self.included(base) - # this is used to extend activerecord bases, as these aren't - # in scope for the module itself. - base.scope :unredacted, -> { where(:redaction_id => nil) } + extend ActiveSupport::Concern + + included do + scope :unredacted, -> { where(:redaction_id => nil) } end def redacted? -- 2.39.5