From 69ee4da6e12fc3060a39c5fecd730fc67976881b Mon Sep 17 00:00:00 2001 From: jonatack Date: Fri, 16 Aug 2013 21:04:37 +0200 Subject: [PATCH] No need for nil checking in commit #7597f0d --- lib/ransack/search.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/ransack/search.rb b/lib/ransack/search.rb index 98084ca..a2bb2fb 100644 --- a/lib/ransack/search.rb +++ b/lib/ransack/search.rb @@ -14,12 +14,10 @@ module Ransack :translate, to: :base def initialize(object, params = {}, options = {}) - params ||= {} + (params ||= {}).delete_if { |k, v| v.blank? && v != false } @context = Context.for(object, options) @context.auth_object = options[:auth_object] @base = Nodes::Grouping.new(@context, 'and') - params = (params.delete_if { |k, v| v.blank? && v != false } - ) if params.present? build(params.with_indifferent_access) end