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

Under newer ActiveResource versions, using JSON errors #146

Open
ninjarobert opened this issue Sep 30, 2016 · 0 comments
Open

Under newer ActiveResource versions, using JSON errors #146

ninjarobert opened this issue Sep 30, 2016 · 0 comments

Comments

@ninjarobert
Copy link

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.

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

1 participant