X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/30756f72ca2e3db095d00bc3b90bb3e47ca4ab6f..7377cb63939f8743ca31e67ea3965c2b15d20057:/app/models/user.rb diff --git a/app/models/user.rb b/app/models/user.rb index 036f2fdc4..de5529e02 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -75,6 +75,11 @@ class User < ActiveRecord::Base has_many :roles, :class_name => "UserRole" + has_many :issues, :class_name => "Issue", :foreign_key => :reported_user_id + has_many :issue_comments + + has_many :reports + scope :visible, -> { where(:status => %w[pending active confirmed]) } scope :active, -> { where(:status => %w[active confirmed]) } scope :identifiable, -> { where(:data_public => true) } @@ -206,7 +211,7 @@ class User < ActiveRecord::Base .where("id != ?", id) .where(sql_for_area) .where("#{sql_for_distance} <= ?", radius) - .order(sql_for_distance) + .order(Arel.sql(sql_for_distance)) .limit(num) else nearby = []