hoodwink.d enhanced
 

juretta.com

How to change the asset path in RubyOnRails | December 10, 2005-->

December 10, 2005
If you don't want to name your asset directories for javascript files and stylesheets "javascripts" and "stylesheets" here is how you can change the default path settings. Add the following snippet to your app/controllers/application.rb:
module ActionView
  module Helpers
    module AssetTagHelper
      # Returns path to a javascript asset. Example:
      #
      #   javascript_path "xmlhr" # => /javascripts/xmlhr.js      
      def javascript_path(source)
        compute_public_path(source, 'js', 'js')        
      end
      # Returns path to a stylesheet asset. Example:
      #
      #   stylesheet_path "style" # => /stylesheets/style.css
      def stylesheet_path(source)
        compute_public_path(source, 'css', 'css')
      end      
    end
  end
end

Diggman

About

juretta.com is the personal workspace of Stefan Saasen. You can send him an email or read more about this site in the „About“ section.

« Previous entry

hoodwink.d
posted over 2 years ago

» Next entry

Ruby Mysql on Mac OS X (Panther)
posted over 2 years ago

Recent comment

On: “Attachr.com: OpenID support added

You need to kill this spam stuff!

posted about 1 year ago by entropie

Look!

Latest links  RSS  

More...