diff options
author | Joshua Peek <josh@joshpeek.com> | 2011-03-29 17:28:46 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2011-03-29 17:28:46 -0500 |
commit | 8e4d0b118bbcdfe6b41d15400d092c871c5a1114 (patch) | |
tree | bd828a140af38772808f4f42dac32a737b4ab669 | |
parent | a5f547cc7937fe1c75ea741b5432e89f7539cb2b (diff) | |
download | rails-8e4d0b118bbcdfe6b41d15400d092c871c5a1114.tar.gz rails-8e4d0b118bbcdfe6b41d15400d092c871c5a1114.tar.bz2 rails-8e4d0b118bbcdfe6b41d15400d092c871c5a1114.zip |
Fix building route set with sprockets in production
-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", |