-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add Rails >= 5.0.beta3 JSON API params parsing #1747
Conversation
data = { :_json => data } unless data.is_a?(Hash) | ||
data.with_indifferent_access | ||
end | ||
ActiveModelSerializers::Jsonapi.install | ||
|
||
# ref https://github.com/rails/rails/pull/21496 | ||
ActionController::Renderers.add :jsonapi do |json, options| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 72 is where travis is failing. media_type undefined
I'm handling this PR. For now, hold off on reviewing further. |
# actionpack/lib/action_dispatch/http/mime_types.rb | ||
Mime::Type.register MEDIA_TYPE, :jsonapi | ||
|
||
mime_type = Mime::Type.lookup(MEDIA_TYPE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is equivalent to mime_type = Mime[MEDIA_TYPE]
.
c1be9e8
to
ea06d3c
Compare
def self.install | ||
# actionpack/lib/action_dispatch/http/mime_types.rb | ||
Mime::Type.register MEDIA_TYPE, :jsonapi | ||
mime_type = Mime::Type.lookup(MEDIA_TYPE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not Mime[:jsonapi]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the time it seemed like this didn't work the same between Rails 4.x and 5. I went tried again this morning it works just fine.
bff3176
to
eec7750
Compare
eec7750
to
bfd0bf4
Compare
per cerebris/jsonapi-resources#642