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

Strange Key Behavior #56

Closed
bgetting opened this issue Aug 29, 2012 · 2 comments
Closed

Strange Key Behavior #56

bgetting opened this issue Aug 29, 2012 · 2 comments

Comments

@bgetting
Copy link

This one is kind of weird. I'm not sure what the issue is, other than when I try and access a method on a Mash, it responds strangely.

For example:

a = order.billing_address
=> #<Hashie::Mash address1="1234 Roslyn Road" address2="" city="Some Harbor" company="" country="United States" country_code="US" first_name="Joe" last_name="Public" latitude="42.14955" longitude="-86.349679" name="Joe Public" phone="555-555-1212" province="Michigan" province_code="MI" zip="49000"> 

a.city
=> "Some Harbor" 

a.zip
=> [[["address1", "1234 Roslyn Road"]], [["address2", ""]], [["city", "Some Harbor"]], [["company", ""]], [["country", "United States"]], [["first_name", "Joe"]], [["last_name", "Public"]], [["latitude", "42.14955"]], [["longitude", "-86.349679"]], [["phone", "555-555-1212"]], [["province", "Michigan"]], [["zip", "49000"]], [["name", "Joe Public"]], [["country_code", "US"]], [["province_code", "MI"]]]

As you can see, for some reason the zip attribute returns an array or everything in the Mash. Is this just a naming thing? Any ideas about what might be causing this?

Thanks for your help.

@mbleigh
Copy link
Contributor

mbleigh commented Aug 29, 2012

Yup, it's a name conflict with Enumerable#zip. You'll either have to rename to zipcode or use a[:zip] instead.

@mbleigh mbleigh closed this as completed Aug 29, 2012
@bgetting
Copy link
Author

Nice. It's data coming in from an external source, so I can't rename. Thanks for verifying, I appreciate it.

On Aug 28, 2012, at 5:40 PM, Michael Bleigh notifications@github.com wrote:

Yup, it's a name conflict with Enumerable#zip. You'll either have to rename to zipcode or use a[:zip] instead.


Reply to this email directly or view it on GitHub.

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

No branches or pull requests

2 participants