a2z
a2z copied to clipboard
Pass Multiple IDs into Item_Lookup
First, I love this gem. What a lifesaver it is! Thank you for all of your hard work. I'm wondering if you could help me whit this issue:
http://stackoverflow.com/questions/18304168/ruby-gem-cant-convert-string-into-integer-error
Looks like a legit issue, thanks for opening it! I'll take a look and see if I can come up with a quick solution. I really need to build out some tests for this gem so this kind of stuff isn't hit again, I just haven't had time unfortunately.
Taking a quick look, it appears that I'm not accounting for an array in A2z::Responses::Item
. I don't have a totally quick fix for this, but for the time being here's what you can do.
-
Fork this repo.
-
Edit the
A2z::Responses::Item.responses
method, and add these 3 lines to the beginning of the method:if data.kind_of?(Array) return data.map { |item| from_response(item) } end
-
Commit your change to your repo, and update your app's Gemfile to reference your forked gem, e.g.:
gem 'a2z', :github => 'ac360/a2z'
When you call @products.item
, you'll get an array of items back instead of a single item.
Sorry about the issue and for not having an official fix right this second, but hopefully this will get you by until I can get a true fix in. Thanks again for the report!
Matt, thanks for the quick response and quick fix. Again, this is a great gem and I am getting a ton of value out of it. So, thank you :) I'll play around with the quick fix. Take care!
I was just about to make a pull request for the same issue, unless one is already in the works @ac360 ?