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

Template expansion does not work with symbolized hashes in 2.8.1 #501

Closed
nicolaa opened this issue Apr 4, 2023 · 1 comment
Closed

Template expansion does not work with symbolized hashes in 2.8.1 #501

nicolaa opened this issue Apr 4, 2023 · 1 comment

Comments

@nicolaa
Copy link

nicolaa commented Apr 4, 2023

See this sample code in console:

> require "addressable/template"
 => true 
3.2.1 :002 > template = Addressable::Template.new("http://example.com/{?query*}")
 => #<Addressable::Template:0x12fac PATTERN:http://example.com/{?query*}> 
3.2.1 :003 > template.expand({"query" => {'foo' => 'bar', 'color' => 'red'}})
 => #<Addressable::URI:0x1d9d4 URI:http://example.com/?foo=bar&color=red> 
3.2.1 :004 > template.expand({query: {foo: "bar", color: "red"}})
rvm/gems/ruby-3.2.1/gems/addressable-2.8.2/lib/addressable/template.rb:900:in `normalize_value': undefined method `to_str' for :foo:Symbol (NoMethodError)

        value = value.respond_to?(:to_ary) ? value.to_ary : value.to_str
                                                                 ^^^^^^^
Did you mean?  to_s
               to_sym
@dentarg
Copy link
Collaborator

dentarg commented Apr 4, 2023

This has been reported #498 and addressed (but not yet released)

Closing as duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants