X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b54c03389bcfd3a87bbdba1bb07f78c748625a28..09ce3d6abb876b49c8b939903b87a52493ac58c5:/app/models/trace.rb diff --git a/app/models/trace.rb b/app/models/trace.rb index 0b9877225..35fee0bf4 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -35,7 +35,7 @@ class Trace < ApplicationRecord has_many :points, :class_name => "Tracepoint", :foreign_key => "gpx_id", :dependent => :delete_all, :inverse_of => :trace scope :visible, -> { where(:visible => true) } - scope :visible_to, ->(u) { visible.where("visibility IN ('public', 'identifiable') OR user_id = ?", u) } + scope :visible_to, ->(u) { visible.where(:visibility => %w[public identifiable]).or(visible.where(:user => u)) } scope :visible_to_all, -> { where(:visibility => %w[public identifiable]) } scope :tagged, ->(t) { joins(:tags).where(:gpx_file_tags => { :tag => t }) }