Skip to content

Commit

Permalink
Allow passing stringy booleans as scope args
Browse files Browse the repository at this point in the history
This implements the solution discussed in #403.

Fixes #403.
  • Loading branch information
shekibobo committed Oct 30, 2014
1 parent 06ab100 commit 0a2d956
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/ransack/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,17 @@ def add_scope(key, args)
else
@scope_args[key] = args
end
@context.chain_scope(key, args)
@context.chain_scope(key, scope_args(args))
end

def scope_args(args)
if Ransack::Constants::TRUE_VALUES.include? args
true
elsif Ransack::Constants::FALSE_VALUES.include? args
false
else
args
end
end

def collapse_multiparameter_attributes!(attrs)
Expand Down

0 comments on commit 0a2d956

Please sign in to comment.