Question

Anyone know how to take the awesome method mentioned in this tutorial and have the stylesheet tags generate with absolute URLs?

Was it helpful?

Solution

Figured it out.

In what goes in the application_helper.rb:

def get_stylesheets
  stylesheets = [] unless stylesheets
  ["http://www.example.com/stylesheets/#{controller.controller_path}/#{controller.action_name}"].each do |ss|
    stylesheets << ss if File.exists? "#{Dir.pwd}/public/stylesheets/#{ss}.css"
  end
end

Works as advertised. Nice!

I've been wanting to do this for ages - now thanks to Rails I can! Woohoo!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top