Open nathanielrb opened 5 years ago
after some research, this is indeed a bug in the template. This has been around for quite some time and should indeed be addressed. Because we include the utils in a top level file all these functions become global. We should address it by including the utils inside the helpers. that way they are still available in web.rb as helpers and can be used as utils were necessary.
my main fear is that some services may depend on this (faulty) behavior where our helpers are global functions.
Since v2.14.0 the template has a flag USE_LEGACY_UTILS
to disable the inclusion of the utility functions as globals. By setting USE_LEGACY_UTILS
to false
you can avoid the conflict on query
with the Faraday gem.
I found this while trying to use the Faraday http gem, and I'm not sure if the problem is Faraday's or the template's. (My Ruby knowledge isn't that deep.)
The
query
defined in the includedSinatraTemplate::Utils
gets mixed up with aquery
used in Faraday's internal definitions (https://github.com/lostisland/faraday/blob/88de44ebe3c40f9050553ce7c0018990b92c2f38/lib/faraday/request.rb#L48-L62)Any ideas?
Example web.rb: