spree / endpoint_base

MIT License
7 stars 16 forks source link

Fix undefined method issue #11

Closed vkvelho closed 9 years ago

vkvelho commented 9 years ago

For some reason this code parsed = ::JSON.parse(body).with_indifferent_access at the line below doesn't work in my environment as the _with_indifferentaccess is undefined for Hash (see attachment). This pull request requires 'active_support/core/ext/hash' and it solves the problem for me.

https://github.com/vkvelho/endpoint_base/blob/52a8d2af7f113844fb71eb2e8bcfeebaaf452b38/lib/endpoint_base/concerns/param_processor.rb#L24

This was very hard to debug, because all I got was 406 raised by "rescue Exception". If I used Honeybadger or Airbrake I got the actual error, but without those services... nothing but 406.

with_indifferent_access_error

huoxito commented 9 years ago

thanks @vkvelho Are you using endpoint_base in a rails application? The change looks fine I'm just curious why requiring it on the sinatra.rb is not working for you.

https://github.com/spree/endpoint_base/blob/dac37b490353cea6ca2b06a1b1b81acc0af6888c/lib/endpoint_base/sinatra.rb#L3

vkvelho commented 9 years ago

Oh, wait a second. My commit is actually made before the commit you reference below. This is weird. I’m using the master branch from the spree/endpoint_base and yet faced the issue.

I’ll dig this a little bit more, so don’t rush with the PR.

EDIT: Using the endpoint_base in openerp_integration, so it should be considered Sinatra app.

vkvelho commented 9 years ago

Oh well.. I'm really confused by this problem now. When I ran the tests using bundle exec rake spec it installed quite a bunch of new gems and I haven't been able to reproduce to problem ever since. Then I removed all the gems (rvm gemset), made bundle install and tried to reproduce the problem, but everything worked right from beginning.

Too weird for Friday. I'll close the issue for now. Thanks for being curious.

:wine_glass: