Dynamic CSS Generation

Hi Cory,

I would put the style name to an instance variable.

def define_style   if request.user_agent.includes("some_cryptic_ie_string")      @style = "style1"   else      @style = "style2"   end end

In your view (most likely in your layout), add following line. You need to put style1.css and style2.css in public/css.

<%= stylesheet_link_tag @style %>

Also, do not forget to add before filter. class YourController < ApplicationController before_filter :define_style

This way, define_style is called every time the controller is processed.

Cheers, Glen