lib/ransack/nodes/value.rb in ransack-0.5.3 vs lib/ransack/nodes/value.rb in ransack-0.5.4
- old
+ new
@@ -63,13 +63,15 @@
val.in_time_zone rescue nil
end
end
def cast_to_boolean(val)
- if val.is_a?(String) && val.blank?
- nil
+ if Constants::TRUE_VALUES.include?(val)
+ true
+ elsif Constants::FALSE_VALUES.include?(val)
+ false
else
- Constants::TRUE_VALUES.include?(val)
+ nil
end
end
def cast_to_string(val)
val.respond_to?(:to_s) ? val.to_s : String.new(val)
\ No newline at end of file