Module: ActionDispatch::Routing::Mapper::Assets

Included in:
ActionDispatch::Routing::Mapper
Defined in:
lib/asset_bundler/routing.rb

Instance Method Summary collapse

Instance Method Details

#images(*paths) ⇒ Object

Renders image assets whenever paths are matched. Defaults to recognizing routes under ‘/images’ if no paths are given.



34
35
36
37
38
39
# File 'lib/asset_bundler/routing.rb', line 34

def images(*paths)
  paths.push '/images' if paths.empty?
  paths.each do |route|
    match "#{route}/*path.:format", :to => 'assets/images#go'
  end
end

#javascripts(*paths) ⇒ Object

Renders Javascript assets whenever paths are matched. Defaults to recognizing routes under ‘/javascripts’ if no paths are given.



12
13
14
15
16
17
# File 'lib/asset_bundler/routing.rb', line 12

def javascripts(*paths)
  paths.push '/javascripts' if paths.empty?
  paths.each do |route|
    match "#{route}/*path.:format", :to => 'assets/javascripts#go'
  end
end

#stylesheets(*paths) ⇒ Object

Renders stylesheet assets whenever paths are matched. Defaults to recognizing routes under ‘/stylesheets’ if no paths are given.



23
24
25
26
27
28
# File 'lib/asset_bundler/routing.rb', line 23

def stylesheets(*paths)
  paths.push '/stylesheets' if paths.empty?
  paths.each do |route|
    match "#{route}/*path.:format", :to => 'assets/stylesheets#go'
  end
end