I can use this method to signal an alternative layout.
someformat.example.com
but when I cache that it will be in, for example
public/someformat
Why involve DNS and the web server if I don't have to?
Is there a way to make a Rails app just stay in a url subdir, i.e. to make all url generation relative? I'm attempting this for a Facebook integration. Many of the views are the same on the Facebook side. I need a way for a request to know it is for a Facebook iframe so it can render the correct layout (just like the iphone layout problem). Is the subdomain hack pretty much my only option? I always feel dirty when I have to touch /etc/hosts. In this case the user never interacts with the URL so any ease of use advantage of format.example.com is lost over example.com/format.
I thought the following would work in my application_controller.rb but resource routes seem to ignore config/routes.rb rules that come before them (in disagreement with the Rails docs AFAICT).
def url_for(options = {})
if params[:format] == :facebook
super(options.merge(:format => :facebook))
else
super(options)
end
end
Maybe I should take this to a mailing list. Thoughts?