aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-08 12:57:07 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-08 12:59:04 +0200
commit80bf68aa1ba7aea9aded5094e81af05b159ceaa4 (patch)
treef31b4072204f6f3839de8fd219017b42cd243f7e /actionpack
parentc2b55c4fbfc427e9ca468fce0392de591c87747a (diff)
downloadrails-80bf68aa1ba7aea9aded5094e81af05b159ceaa4.tar.gz
rails-80bf68aa1ba7aea9aded5094e81af05b159ceaa4.tar.bz2
rails-80bf68aa1ba7aea9aded5094e81af05b159ceaa4.zip
prepend the assets route instead of appending, closes #436
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb9
-rw-r--r--actionpack/lib/sprockets/railtie.rb2
2 files changed, 7 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 97e8ccc9a5..5097f6732d 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -224,6 +224,7 @@ module ActionDispatch
self.valid_conditions.push(:controller, :action)
@append = []
+ @prepend = []
@disable_clear_and_finalize = false
clear!
end
@@ -232,7 +233,6 @@ module ActionDispatch
clear! unless @disable_clear_and_finalize
eval_block(block)
finalize! unless @disable_clear_and_finalize
-
nil
end
@@ -240,6 +240,10 @@ module ActionDispatch
@append << block
end
+ def prepend(&block)
+ @prepend << block
+ end
+
def eval_block(block)
if block.arity == 1
raise "You are using the old router DSL which has been removed in Rails 3.1. " <<
@@ -262,8 +266,6 @@ module ActionDispatch
end
def clear!
- # Clear the controller cache so we may discover new ones
- @controller_constraints = nil
@finalized = false
routes.clear
named_routes.clear
@@ -271,6 +273,7 @@ module ActionDispatch
:parameters_key => PARAMETERS_KEY,
:request_class => request_class
)
+ @prepend.each { |blk| eval_block(blk) }
end
def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false)
diff --git a/actionpack/lib/sprockets/railtie.rb b/actionpack/lib/sprockets/railtie.rb
index 9c10decd60..0b4b0638b2 100644
--- a/actionpack/lib/sprockets/railtie.rb
+++ b/actionpack/lib/sprockets/railtie.rb
@@ -39,7 +39,7 @@ module Sprockets
end
end
- app.routes.append do
+ app.routes.prepend do
mount app.assets => assets.prefix
end