So you are sitting there around the house watching reruns of Smallville and Seinfeld and you think, “I wish I could jump onto the CSS Naked Day bandwagon with my Ruby on Rails application”, well you are in luck. Conditional statements in Rails are a piece of cake and with logical expressions like “unless” we save ourselves a ton of code.
In our layout when we call our stylesheet link tag we would just add some conditional code to the end like this:
<%= stylesheet_link_tag "default" unless (Time.now.month == 4) and (Time.now.day == 5) %>
And that’s it, show the stylesheet unless it’s April 5th. The carriage return is for the blog, this can go on one line. I do have to say, be nice to your users here, you just might break the shit out of some of your UI without your CSS. Most Rails applications have more then just a blog on them so I suggest not doing this on a production application (do I really need to be saying this?).