class ActionController::Base
around_filter :respond_to_mobile
def respond_to_mobile
request.accepts.unshift Mime::EXTENSION_LOOKUP['mobile'] if request.mobile?
yield
response.content_type = "text/html" if response.content_type == Mime::EXTENSION_LOOKUP['mobile']
end
end
以下のようなコードが組み込まれればよいはず。
class ActionController::Base around_filter :respond_to_mobile def respond_to_mobile request.accepts.unshift Mime::EXTENSION_LOOKUP['mobile'] if request.mobile? yield response.content_type = "text/html" if response.content_type == Mime::EXTENSION_LOOKUP['mobile'] end end
http://weblog.rubyonrails.com/2007/9/30/rails-2-0-0-preview-release の Multiview を使うべきか。