Just found a weird issue, and I want to know if anyone else has experienced
it.
I've got multiple Mime::Type aliases:
Mime::Type.register_alias "text/html", :iphone
Mime::Type.register_alias "text/html", :mobile
And corresponding application.:format:.erb files:
application.html.erb
application.iphone.erb
application.mobile.erb
Now, it works perfectly in Firefox, but in IE, the mobile version is
rendered by default (instead of the expected html version)
After a little investigation, request.format == text/html in FF, but == */*
in IE, which is what I imagine the problem is.
If anyone else has experienced, I'll fix the bug and post it to core, but I
just want to make sure I'm not going crazy first :)
----------------------------------------------
Myles Eftos
Mobile: +61-409-293-183
MadPilot Productions
URL: http://www.madpilot.com.au
Phone: +618-9467-7651
Fax: +618-9467-6289
Try our time tracking system: 88 Miles!
http://www.88miles.net
-Adam
request.format = "html" if request.format == "*/*"
Fixed the problem - Looks like I'll have to dig in to the core and try to
sort out a patch...
Thanks
----------------------------------------------
Myles Eftos
Mobile: +61-409-293-183
MadPilot Productions
URL: http://www.madpilot.com.au
Phone: +618-9467-7651
Fax: +618-9467-6289
Try our time tracking system: 88 Miles!
http://www.88miles.net
----------------------------------------------
Myles Eftos
Mobile: +61-409-293-183
MadPilot Productions
URL: http://www.madpilot.com.au
Phone: +618-9467-7651
Fax: +618-9467-6289
Try our time tracking system: 88 Miles!
http://www.88miles.net
> -----Original Message-----
> From: rails-...@googlegroups.com
> [mailto:rails-...@googlegroups.com] On Behalf Of Adam Salter
> Sent: Tuesday, 22 January 2008 11:49
> To: rails-...@googlegroups.com
> Subject: [rails-oceania] Re: Multiple views issue in IE
>
>
>
Yes it is. See 14.1 of RFC2616. You're confusing acceptable with
desirable.
Cheers,
--
Nathan de Vries
From ActionController::AbstractRequest:
def format
@format ||= parameters[:format] ? Mime::Type.lookup_by_extension(parameters[:format]) : accepts.first
end
Where 'accepts.first' is the result of:
Mime::Type.parse(@env['HTTP_ACCEPT'])
If you want multiple HTML formats (browser, mobile, iPhone), you'll
probably want to use a 'format' query parameter or use user agent
detection (in a before_filter):
request.format = :iphone if request.env["HTTP_USER_AGENT"][/iPhone/]
----------------------------------------------
Myles Eftos
Mobile: +61-409-293-183
MadPilot Productions
URL: http://www.madpilot.com.au
Phone: +618-9467-7651
Fax: +618-9467-6289
Try our time tracking system: 88 Miles!
http://www.88miles.net
> -----Original Message-----
> From: rails-...@googlegroups.com
> [mailto:rails-...@googlegroups.com] On Behalf Of Nathan de Vries
> Sent: Tuesday, 22 January 2008 12:12
> To: rails-...@googlegroups.com
> Subject: [rails-oceania] Re: Multiple views issue in IE
>