Browse Source

empty

test-review-app-access
Kat 1 year ago
parent
commit
255f61e3d1
  1. 1
      app/models/lettings_log.rb

1
app/models/lettings_log.rb

@ -58,6 +58,7 @@ class LettingsLog < Log
needstypes.each { |needstype| query = query.or(filter_by_needstype(needstype)) } needstypes.each { |needstype| query = query.or(filter_by_needstype(needstype)) }
query.all query.all
} }
scope :search_by, lambda { |param| scope :search_by, lambda { |param|
by_id = Arel.sql("CASE WHEN lettings_logs.id = #{param.to_i} THEN 0 ELSE 1 END") by_id = Arel.sql("CASE WHEN lettings_logs.id = #{param.to_i} THEN 0 ELSE 1 END")
by_tenant_code = Arel.sql("CASE WHEN tenancycode = '#{param}' THEN 0 WHEN tenancycode ILIKE '%#{param}%' THEN 1 ELSE 2 END") by_tenant_code = Arel.sql("CASE WHEN tenancycode = '#{param}' THEN 0 WHEN tenancycode ILIKE '%#{param}%' THEN 1 ELSE 2 END")

Loading…
Cancel
Save