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

Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compat #21869

Merged
merged 1 commit into from Oct 6, 2015

Conversation

Projects
None yet
2 participants
@jeremy
Copy link
Member

jeremy commented Oct 5, 2015

Rails 4.x and earlier didn't support Mime::Type[:FOO], so libraries that support multiple Rails versions would've had to feature-detect whether to use Mime::Type[:FOO] or Mime::FOO.

Mime[:foo] has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility.

Note: Mime::ALL isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as Mime[:all]. We use it internally as a wildcard for respond_to negotiation. If you use this internal constant, continue to reference it with Mime::ALL.

Ref. efc6dd5

cc @tenderlove

@jeremy jeremy force-pushed the jeremy:mime-constant-deprecation branch 2 times, most recently from e21d990 to bae817c Oct 5, 2015

gsamokovarov added a commit to gsamokovarov/web-console that referenced this pull request Oct 5, 2015

Don't reference deprecated Mime::CONTENT_TYPES
We have deprecated the reference of custom Mime-Types through Mime
constants.

See rails/rails@efc6dd5 and
rails/rails#21869.

I have to backport this to the 2-0-stable branch and will release a new
2.x.x release once #164 is resolved.

Closes #167.
Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compat
Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries
that support multiple Rails versions would've had to feature-detect
whether to use `Mime::Type[:FOO]` or `Mime::FOO`.

`Mime[:foo]` has been around for ages to look up registered MIME types
by symbol / extension, though, so libraries and plugins can safely
switch to that without breaking backward- or forward-compatibility.

Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup
by type or extension, so it's not available as `Mime[:all]`. We use it
internally as a wildcard for `respond_to` negotiation. If you use this
internal constant, continue to reference it with `Mime::ALL`.

Ref. efc6dd5

@jeremy jeremy force-pushed the jeremy:mime-constant-deprecation branch from bae817c to 565094a Oct 6, 2015

jeremy added a commit that referenced this pull request Oct 6, 2015

Merge pull request #21869 from jeremy/mime-constant-deprecation
Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compat

@jeremy jeremy merged commit 71317e6 into rails:master Oct 6, 2015

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@jeremy jeremy deleted the jeremy:mime-constant-deprecation branch Oct 6, 2015

@kaspth

This comment has been minimized.

Copy link
Member

kaspth commented Oct 6, 2015

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment