From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=770622
---
src/app/models/deployment.rb | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/app/models/deployment.rb b/src/app/models/deployment.rb
index 40e251f..f73b0b9 100644
--- a/src/app/models/deployment.rb
+++ b/src/app/models/deployment.rb
@@ -455,9 +455,12 @@ class Deployment < ActiveRecord::Base
private
def self.apply_search_filter(search)
+ # TODO: after upgrading to 3.1 the SQL join statement can be done in Rails way by
adding a has_many association to providers through provider_accounts
+ # (Rails before version 3.1 does not support nested associations with through
param)
if search
includes(:pool, :provider_accounts => :provider).
- where("pools.name ILIKE :search OR deployments.name ILIKE :search OR
providers.name ILIKE :search",
+ joins("LEFT OUTER JOIN provider_types ON provider_types.id =
providers.provider_type_id").
+ where("pools.name ILIKE :search OR deployments.name ILIKE :search OR
provider_types.name ILIKE :search",
:search => "%#{search}%")
else
scoped
--
1.7.6.5