Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10796 (closed defect: fixed)

Opened 6 months ago

Last modified 5 months ago

[PATCH] request.format should be equal to symbol

Reported by: bscofield Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords: mimetype format
Cc:

Description

Currently, you can assign request.format a mime type via that type's symbol. E.g.,

request.format = :iphone

You can't, however, determine the mime type of the format with the symbol. That is, the assertion in this code would fail were it in a test:

request.format = :iphone
assert_equal :iphone, request.format

The included patch (with test) remedies this by allowing either the string or the symbol representation of a mime type to be used in equality testing.

Attachments

mime_type_equals_symbol.patch (1.2 kB) - added by bscofield on 01/13/08 18:38:41.

Change History

01/13/08 18:38:41 changed by bscofield

  • attachment mime_type_equals_symbol.patch added.

01/15/08 16:32:21 changed by DefV

+1

Applies correctly, tests pass and the change makes sense.

01/15/08 16:47:58 changed by djanowski

All good, +1

01/20/08 22:55:29 changed by nzkoz

  • status changed from new to closed.
  • resolution set to fixed.

(In [8677]) Ensure mime types can be compared with symbols. Closes #10796 [bscofield]

02/10/08 01:03:30 changed by nzkoz

(In [8829]) 2-0-stable: Ensure mime types can be compared with symbols. References #10796 [bscofield]

Merging [8677]