def stylesheet_auto_link_tags stylesheets_path = "#{RAILS_ROOT}/public/stylesheets/" candidates = [ "#{controller.controller_name}", "#{controller.controller_name}_#{controller.action_name}" ] candidates.inject("") do |buf, css| buf << stylesheet_link_tag(css) if FileTest.exist?("#{stylesheets_path}/#{css}.css") buf end end
Compliments of Dema
Note: Anyone interested in this might also be interested in the bundled_resource plugin (google for it).
Hehe, thanks Duane, I'll begin posting my snippets here as well.