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 a746330
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 args.in? Ransack::Constants::TRUE_VALUES
true
elsif args.in? Ransack::Constants::FALSE_VALUES
false
else
args
end
end

def collapse_multiparameter_attributes!(attrs)
Expand Down

0 comments on commit a746330

Please sign in to comment.