module ApplicationHelper
def rcss_path(name)
file_base = name.gsub(/\.css$/i, '')
return "#{RAILS_ROOT}/app/views/stylesheets/#{file_base}.rcss"
end
def stylesheet_tag(name)
date = File.mtime(rcss_path(name)).to_i
return ""
end
end
In app/controllers/stylesheets_controller.rb
class StylesheetsController < ApplicationController
include ApplicationHelper
layout nil
session :off
def rcss
if name = params[:id]
file_path = rcss_path(name)
expires_in 3.days
render(:file => file_path, :content_type => "text/css")
else
render(:nothing => true, :status => 404)
end
end
end