Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate that values for unrecognized query options are strings #68

Open
joshed-io opened this issue Feb 10, 2015 · 0 comments
Open

Validate that values for unrecognized query options are strings #68

joshed-io opened this issue Feb 10, 2015 · 0 comments

Comments

@joshed-io
Copy link
Contributor

If a non-string is passed as an query option value for a key we don't track (not :group_by or :filters, etc) we should validate that it is a string so it can be escaped later on.

Currently passing a non-string just throws a confusing exception:

>> Keen.count("votes", :max_age => 60)
NoMethodError: undefined method `gsub' for 60:Fixnum
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/cgi/util.rb:7:in `escape'
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/keen-0.8.8/lib/keen/client.rb:109:in `block in preprocess_params'
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/keen-0.8.8/lib/keen/client.rb:109:in `each'
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/keen-0.8.8/lib/keen/client.rb:109:in `map'
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/keen-0.8.8/lib/keen/client.rb:109:in `preprocess_params'
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/keen-0.8.8/lib/keen/client/querying_methods.rb:239:in `_query_url'
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/keen-0.8.8/lib/keen/client/querying_methods.rb:223:in `query'
        from /Users/dzello/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/keen-0.8.8/lib/keen/client/querying_methods.rb:19:in `count'
        from (irb):7
        from /Users/dzello/.rbenv/versions/1.9.3-p448/bin/irb:12:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant