[#345] remove deprecation warning with eager loading table that are referenced in a string SQL snippet

This commit is contained in:
Alexander Machehin 2014-04-29 13:18:12 +06:00
parent 2a8fa0e64b
commit 46c3b8cabe
1 changed files with 2 additions and 1 deletions

View File

@ -31,7 +31,8 @@ class Issue < ActiveRecord::Base
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст") # Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
scope :search, ->(q) { where("#{table_name}.title ILIKE ?", "%#{q.mb_chars.downcase}%") if q.present? } scope :search, ->(q) { where("#{table_name}.title ILIKE ?", "%#{q.mb_chars.downcase}%") if q.present? }
scope :without_pull_requests, -> { scope :without_pull_requests, -> {
where('NOT EXISTS (select null from pull_requests as pr where pr.issue_id = issues.id)') where('NOT EXISTS (select null from pull_requests as pr where pr.issue_id = issues.id)').
references(:pull_requests)
} }
def assign_uname def assign_uname