jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
319 stars 63 forks source link

Adding with_indiferent_access to controller params #67

Closed cassidycodes closed 5 years ago

cassidycodes commented 6 years ago

In Rails 4.2, to_unsafe_hash converts the params to a Hash and the values can only be accessed with the keys as strings.

This change allows for compatibility with Rails 4.2.

cassidycodes commented 6 years ago

@beauby I've tested this against Rails 5.1.4 both in a controller test and by sending a POST to the server.

https://github.com/cassidycodes/Rails-5-Test-for-jsonapi-rails/blob/master/test/controllers/test_controller_test.rb

beauby commented 6 years ago

Thanks for the PR @cassidycodes. I'll need a bit more time to figure out whether there's a better solution, but I'm keeping this under my radar.

cassidycodes commented 6 years ago

@beauby Ok, let me know if you want any changes on this PR.

gmkohler commented 5 years ago

@dawidof bumping attention, would like to get off of a fork which includes this and https://github.com/jsonapi-rb/jsonapi-rails/pull/106 if at all possible (though my apps will be moving off rails 4 shortly, this seems like a no-harm change)

baxang commented 5 years ago

Bumping this up too - can this PR be reviewed? We're still on Rails 4.2.

baxang commented 5 years ago

@dawidof thanks for merging - Looking forward to a new release!