diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/engine.rb | 16 |
1 files changed, 14 insertions, 2 deletions
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", |