You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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%
First off, 👍 to #98
I upgraded the
tracker_api
on agrape
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_exampleThis is happening because
grape
usesvirtus
andtracker_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 ditchvirtus
entirely.The text was updated successfully, but these errors were encountered: