From 8e4d0b118bbcdfe6b41d15400d092c871c5a1114 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 29 Mar 2011 17:28:46 -0500 Subject: Fix building route set with sprockets in production --- railties/lib/rails/engine.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 82ce4c8cbb..85f7d22fc9 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -433,12 +433,24 @@ module Rails end def routes - @routes ||= ActionDispatch::Routing::RouteSet.new - @routes.add_route(assets, {}, {}, {}, nil, false) if config.use_sprockets + @routes ||= build_route_set @routes.append(&Proc.new) if block_given? @routes end + def build_route_set + routes = ActionDispatch::Routing::RouteSet.new + + engine = self + routes.append do + if engine.config.use_sprockets + routes.add_route(engine.assets, {}, {}, {}, nil, false) + end + end + + routes + end + def self.default_sprockets_paths [ "app/assets", -- cgit v1.2.3