This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Description
First off, 👍 to #98
I upgraded the tracker_api on a grape API and noticed that boolean params set to false were becoming nil. I set up a small app to demonstrate this - https://github.com/cmoylan/tracker_grape_example
# without tracker_api in the Gemfile
$ curl localhost:9292/test?my_param=false
false%
$ curl localhost:9292/test?my_param=true
true%
$ curl localhost:9292/test?my_param=asdf
my_param is invalid%
# with tracker_api in Gemfile
$ curl localhost:9292/test?my_param=false
$ curl localhost:9292/test?my_param=true
true%
$ curl localhost:9292/test?my_param=asdf
my_param is invalid%
This is happening because grape uses virtus and tracker_api is adding this bit - https://github.com/dashofcode/tracker_api/blob/master/lib/virtus/attribute/nullify_blank.rb#L17. An additional check like && output != false would solve it. Or just use this as more motivation to ditch virtus entirely.