]> git.openstreetmap.org Git - rails.git/commitdiff
Convert lib files to model concerns
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 3 Jun 2020 14:44:26 +0000 (16:44 +0200)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 3 Jun 2020 14:44:26 +0000 (16:44 +0200)
app/models/concerns/consistency_validations.rb [moved from lib/consistency_validations.rb with 98% similarity]
app/models/concerns/redactable.rb [moved from lib/redactable.rb with 57% similarity]

similarity index 98%
rename from lib/consistency_validations.rb
rename to app/models/concerns/consistency_validations.rb
index 7e9b335861e6f913e5aff61da9147168f6c3ccd9..00c6ce9934b7b37c6a95f74e32a68d4678714668 100644 (file)
@@ -1,4 +1,6 @@
 module ConsistencyValidations
 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
   # 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
similarity index 57%
rename from lib/redactable.rb
rename to app/models/concerns/redactable.rb
index 6efdae0efd4b2dfeb8bf91c3969c88af54df8594..ccf04907f28ff363cbc0f1d2e409076c3fd254a6 100644 (file)
@@ -1,10 +1,8 @@
-require "osm"
-
 module Redactable
 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?
   end
 
   def redacted?