Convert some model mixins to concerns
This commit is contained in:
parent
ad85a03e21
commit
82f3dc6823
3 changed files with 9 additions and 5 deletions
|
@ -1,6 +1,8 @@
|
|||
require "delegate"
|
||||
|
||||
module GeoRecord
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
# Ensure that when coordinates are printed that they are always in decimal degrees,
|
||||
# and not e.g. 4.0e-05
|
||||
# Unfortunately you can't extend Numeric classes directly (e.g. `Coord < Float`).
|
||||
|
@ -19,9 +21,9 @@ module GeoRecord
|
|||
# the database.
|
||||
SCALE = 10000000
|
||||
|
||||
def self.included(base)
|
||||
base.scope :bbox, ->(bbox) { base.where(OSM.sql_for_area(bbox)) }
|
||||
base.before_save :update_tile
|
||||
included do
|
||||
scope :bbox, ->(bbox) { where(OSM.sql_for_area(bbox)) }
|
||||
before_save :update_tile
|
||||
end
|
||||
|
||||
# Is this node within -90 >= latitude >= 90 and -180 >= longitude >= 180
|
|
@ -1,6 +1,6 @@
|
|||
require "osm"
|
||||
|
||||
module NotRedactable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def redacted?
|
||||
false
|
||||
end
|
|
@ -1,4 +1,6 @@
|
|||
module ObjectMetadata
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def add_metadata_to_xml_node(el, osm, changeset_cache, user_display_name_cache)
|
||||
el["changeset"] = osm.changeset_id.to_s
|
||||
el["redacted"] = osm.redaction.id.to_s if osm.redacted?
|
Loading…
Add table
Add a link
Reference in a new issue