Use media_type instead of content_type internally#36854
Merged
kaspth merged 1 commit intorails:masterfrom Aug 4, 2019
Merged
Conversation
These calls to `content_type` were triggering the deprecation from c631e8d in upgraded applications. We can use `media_type` in all of these cases to avoid the deprecation.
eugeneius
referenced
this pull request
Aug 4, 2019
I changed return value of `ActionDispatch::Response#content_type` in #36034. But this change seems to an obstacle to upgrading. #36034 (comment) Therefore, I restored the behavior of `ActionDispatch::Response#content_type` to 5.2 and deprecated old behavior. Also, made it possible to control the behavior with the config.
Contributor
|
Sweet! |
|
Thanks! |
Contributor
|
Great! Thanks. I've bundled this change up as a monkey patch for use until next rc/final: |
Contributor
|
Hmm, shouldn't this be cherry-picked onto the 6-0-stable branch? |
tegon
added a commit
to heartcombo/devise
that referenced
this pull request
Aug 6, 2019
Before Rails 6 RC2, the `ActionDispatch::Response#content_type` method would return only the media part of the `Content-Type` header, without any other parts. Now the `#content_type` method returns the entire header - as it is - and `#media_type` should be used instead to get the previous behavior. Ref: - rails/rails#36034 - rails/rails#36854
tegon
added a commit
to heartcombo/devise
that referenced
this pull request
Aug 6, 2019
Before Rails 6 RC2, the `ActionDispatch::Response#content_type` method would return only the media part of the `Content-Type` header, without any other parts. Now the `#content_type` method returns the entire header - as it is - and `#media_type` should be used instead to get the previous behavior. Ref: - rails/rails#36034 - rails/rails#36854
tegon
added a commit
to heartcombo/devise
that referenced
this pull request
Aug 7, 2019
* Fix specs on Rails 6 RC2 `ActiveRecord::MigrationContext` now has a `schema_migration` attribute. Ref: https://github.com/rails/rails/pull/36439/files#diff-8d3c44120f7b67ff79e2fbe6a40d0ad6R1018 * Use `media_type` instead of `content_type` Before Rails 6 RC2, the `ActionDispatch::Response#content_type` method would return only the media part of the `Content-Type` header, without any other parts. Now the `#content_type` method returns the entire header - as it is - and `#media_type` should be used instead to get the previous behavior. Ref: - rails/rails#36034 - rails/rails#36854 * Use render template instead of render file Render file will need the full path in order to avoid security breaches. In this particular case, there's no need to use render file, it's ok to use render template. Ref: rails/rails#35688 * Don't set `represent_boolean_as_integer` on Rails 6 * Update comments [ci skip]
kaspth
added a commit
that referenced
this pull request
Aug 8, 2019
…t_type Use media_type instead of content_type internally
Contributor
|
@connorshea it should, I just forgot to do it. Here it is: f57aac4 Thanks! |
maximumtiu
added a commit
to maximumtiu/upgrade-rails-workshop
that referenced
this pull request
Aug 13, 2019
rails/rails#36490 caused a deprecation warning to be raised from within Rails. rails/rails#36854 is the fix and has been merged into Rails master. This commit adds a config option as a work-around until Rails 6.0 is officially released.
maximumtiu
added a commit
to maximumtiu/upgrade-rails-workshop
that referenced
this pull request
Aug 13, 2019
rails/rails#36490 caused a deprecation warning to be raised from within Rails. rails/rails#36854 is the fix and has been merged into Rails master. This commit adds a config option as a work-around until Rails 6.0 is officially released.
Contributor
|
I know this is already merged, but this causes the following error when used with ActiveStorage. ImageAttachment is the class from my application. Otherwise, my ActiveStorage implementation is plain and simple. |
Member
Author
|
That error was introduced in #36847; I don't think it's related to this change. Can you open a new issue, and include a sample application that reproduces the problem? |
Contributor
|
I think you're right. Sorry for the miss-fire there. |
fabrik42
added a commit
to fabrik42/acts_as_api
that referenced
this pull request
Oct 13, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These
content_typecalls were triggering the deprecation from #36490 in upgraded applications.This problem was reported as a comment on the original pull request: #36490 (comment)
We can use
media_typein all of these cases to avoid the deprecation.