Closed Landwookie closed 3 years ago
Hi there! Can you provide some code reproducing the issue, or at least the error backtrace? All tests are passing, so it's something not covered.
I'm seeing the same issue as well with v5.2.0
2020-12-22 23:07:53 - NoMethodError - undefined method `match?' for #<Hash:0x00007fb2d5b902a0>:
/Users/x/.rvm/gems/ruby-2.6.5/gems/browser-5.2.0/lib/browser/blackberry.rb:20:in `match?'
/Users/x/.rvm/gems/ruby-2.6.5/gems/browser-5.2.0/lib/browser/browser.rb:106:in `each'
/Users/x/.rvm/gems/ruby-2.6.5/gems/browser-5.2.0/lib/browser/browser.rb:106:in `find'
/Users/x/.rvm/gems/ruby-2.6.5/gems/browser-5.2.0/lib/browser/browser.rb:106:in `new'
In a Sinatra app with the following code:
browser = Browser.new(:ua => request.user_agent, :accept_language => "en-us")
It's been a while since the initializer signature changed from a hash to Browser.new(ua, accept_language:)
. I mean years, maybe around 2016.
I have no idea how this didn't explode before! 😱🤯
Can you please try using the "new" signature and see if you still get the exception?
Ah yeah it was the old initializer signature in a legacy app, Browser.new(ua, accept_language:)
works!
The old signature works in 5.1.0, this could be the issue @Landwookie ran into.
Thanks for the quick reply!
Got an error after using devise to sign in, in our app.
Error was that match? is not working with a hash. It accured after update to 5.2.0 in 5.1.0 it works like a charm.