I have some basic respond_to blocks that essentially look like this:
respond_to do |format|
format.iphone { render }
format.mobile { render }
end
This is working great right now and I have it all over the place in my
code. Kind of odd that there’s no format for just plain ol’ HTML
right? Right. Since I’m not building a desktop browser version yet,
I’m not terribly concerned about supporting desktop browsers, but I do
want something that at least works. But here’s the problem:
the iphone version doesn’t work on all desktop browsers and won’t
for the foreseeable future (yeah, so i went a little iphone crazy)
the mobile version’s MIME type is “application/vnd.wap.xhtml+xml”
which won’t work on desktop browsers
For now what I’d like to do is render the mobile version to desktop
browsers but with a mime type of “text/html”. Question is, what is the
easiest way to accomplish this given a fair amount of existing respond
to blocks and templates named with *.mobile.erb
I’m tempted to just take the easy way out and change the mime type of
mobile to “text/html”, but am curious if there are any smarter
alternatives.
right? Right. Since I’m not building a desktop browser version yet,
I’m not terribly concerned about supporting desktop browsers, but I do
want something that at least works. But here’s the problem:
Um. format.html? Rails assumes that format if there isn’t a
different one explicitly requested.
Um. format.html? Rails assumes that format if there isn’t a
different one explicitly requested.
Good to know. But if I’m going to render the same template as another
format, some changes will need to be made. But maybe it’s as simple as
changing all templates named “.mobile.erb" to ".erb” so that
format.html can find them. Or if that doesn’t work use a variation on
the render call to force the html format to render the mobile template.