"Not all elements respond to to_xml"
It's only started happening the past day or so, and I'm really struggling to figure out what it is. There has been no changes to our code at all.
Here's the backtrace:
Not all elements respond to to_xml
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ext/array/conversions.rb:163:in `to_xml'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ext/hash/conversions.rb:115:in `to_xml'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ext/hash/conversions.rb:110:in `each'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ext/hash/conversions.rb:110:in `to_xml'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb:134:in `call'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb:134:in `_nested_structures'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb:58:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ext/hash/conversions.rb:109:in `__send__'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ext/hash/conversions.rb:109:in `to_xml'
/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.12/lib/active_resource/formats/xml_format.rb:15:in `encode'
/usr/lib/ruby/gems/1.8/gems/activeresource-2.3.12/lib/active_resource/base.rb:976:in `encode'
/usr/lib/ruby/gems/1.8/gems/shopify_api-1.2.5/lib/shopify_api.rb:271:in `only_id'
/usr/lib/ruby/gems/1.8/gems/shopify_api-1.2.5/lib/shopify_api.rb:256:in `open'
On Dec 14, 12:56 pm, David Speake <da...@verycleverstuff.co.uk> wrote:
> Has anyone come across this error before?
>
> "Not all elements respond to to_xml"
>
> It's only started happening the past day or so, and I'm really struggling to figure out what it is. There has been no changes to our code at all.
>
> Here's the backtrace:
>
> Not all elements respond to to_xml
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/array/conversions.rb:163:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:115:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:110:in `each'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:110:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/ builder-2.1.2/builder/xmlbase.rb:134:in `call'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/ builder-2.1.2/builder/xmlbase.rb:134:in `_nested_structures'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/ builder-2.1.2/builder/xmlbase.rb:58:in `method_missing'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:109:in `__send__'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:109:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activeresource-2.3.12/lib/active_resource/forma ts/xml_format.rb:15:in `encode'
> /usr/lib/ruby/gems/1.8/gems/activeresource-2.3.12/lib/active_resource/base. rb:976:in `encode'
I can't help but think something has changed on Shopify's end, as I've checked the database integrity, and all seems to be fine there.
I'll persevere for now and see if there's any new developments.
Maybe a silly question, but how can I print/interrogate the object to see what the data is? I'd do something like var_dump or print_r in PHP but never found a way to do it in Rails.
If you were not aware of it, any Ruby object comes with an inspect
method too, allowing you far more control over seeing what makes an
object tick than the primitive PHP var_dump and print_r, commands that
were relegated to the backwaters 5 years ago or more :)
On Dec 14, 1:20 pm, Aaron McLeod <sircoolgu...@gmail.com> wrote:
> Can use the ruby debugger, and inspect the object using the p command.
> Like so:
>
> def index
> @products = ShopfiyAPI::Product.all
> require 'ruby-debug'; debugger
> end
>
> In terminal:
>
> p @products
>
> --
> Aaron McLeodhttp://agmprojects.com
>
>
>
>
>
>
>
> On Wednesday, 14 December, 2011 at 1:16 PM, David Speake wrote:
> > Hmm. That's a tricky one as we haven't gone through the mammoth task of upgrading to Rails 3 so I'm already at the newest version I can go to.
>
> > I can't help but think something has changed on Shopify's end, as I've checked the database integrity, and all seems to be fine there.
>
> > I'll persevere for now and see if there's any new developments.
>
> > Maybe a silly question, but how can I print/interrogate the object to see what the data is? I'd do something like var_dump or print_r in PHP but never found a way to do it in Rails.
>
> > On 14 Dec 2011, at 18:10, Dave wrote:
>
> > > I would upgrade your gem to the latest for one... after that.. put in
> > > some exception handlers and try and isolate where you are sending an
> > > object that should have a to_xml method but doesn't.
>
On Dec 14, 12:56 pm, David Speake <da...@verycleverstuff.co.uk> wrote:
> Has anyone come across this error before?
>
> "Not all elements respond to to_xml"
>
> It's only started happening the past day or so, and I'm really struggling to figure out what it is. There has been no changes to our code at all.
>
> Here's the backtrace:
>
> Not all elements respond to to_xml
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/array/conversions.rb:163:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:115:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:110:in `each'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:110:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/ builder-2.1.2/builder/xmlbase.rb:134:in `call'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/ builder-2.1.2/builder/xmlbase.rb:134:in `_nested_structures'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/vendor/ builder-2.1.2/builder/xmlbase.rb:58:in `method_missing'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:109:in `__send__'
> /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.12/lib/active_support/core_ex t/hash/conversions.rb:109:in `to_xml'
> /usr/lib/ruby/gems/1.8/gems/activeresource-2.3.12/lib/active_resource/forma ts/xml_format.rb:15:in `encode'
> /usr/lib/ruby/gems/1.8/gems/activeresource-2.3.12/lib/active_resource/base. rb:976:in `encode'
I'm not sure why it would break things though, as my code should ignore any new elements. I'll add a migration though and that should clear things up.
Thanks again,
Dave
We’re taking a look at this now. Thanks for raising a flag about the issue.
Edward Ocampo-Gooding
Developer Advocate, Shopify