Skip to content
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

@jeremy
Copy link
Member

@jeremy 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 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 issue Oct 5, 2015
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.
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 mime-constant-deprecation branch from bae817c to 565094a Oct 6, 2015
jeremy added a commit that referenced this issue Oct 6, 2015
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
@jeremy jeremy deleted the mime-constant-deprecation branch Oct 6, 2015
@kaspth
Copy link
Member

@kaspth kaspth commented Oct 6, 2015

❤️

prathamesh-sonpatki added a commit to prathamesh-sonpatki/maildown that referenced this issue Jan 13, 2016
schneems added a commit to codetriage/maildown that referenced this issue Jan 13, 2016
walreyes added a commit to walreyes/write_xlsx_rails that referenced this issue Oct 31, 2017
jarmopi added a commit to puavo-org/puavo-web that referenced this issue Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants