Under newer ActiveResource versions, using JSON errors
Opened this issue · 0 comments
ninjarobert commented
Hello,
We recently upgraded our Rails app to use Rails 4.2, which brings in ActiveResource 4.1.0.
Under this version, if you use the json request format with Chargify, it does not work. It currently errors and sends back those errors in a format ActiveResource doesn't handle.
For example, calling Chargify::Customer.create yields
NoMethodError: undefined method `each' for "can't be blank":String
from /Users/robertrouse/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activeresource-4.1.0/lib/active_resource/validations.rb:37:in `block in from_hash'
It's expecting an array and is not getting that. I breakpointed in ActiveResource itself and the error hash looks like this.
pry(#<ActiveResource::Errors>)> messages
=> {"customer"=>"can't be blank"}
Using the XML request format works fine, which is why I assume there haven't been reports on things not working.