diff options
author | Matt Jones <al2o3cr@gmail.com> | 2008-09-07 10:21:34 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2008-09-07 10:21:34 -0500 |
commit | 7e6cda15f8dae517f9605f73aa1c966a29d4930a (patch) | |
tree | 822f74af40156d11fdcbd3031b0534bc8126e1f3 /actionpack/lib/action_controller/routing | |
parent | 41efd73887c00ffd228b05d9346ec47a1f3759b9 (diff) | |
download | rails-7e6cda15f8dae517f9605f73aa1c966a29d4930a.tar.gz rails-7e6cda15f8dae517f9605f73aa1c966a29d4930a.tar.bz2 rails-7e6cda15f8dae517f9605f73aa1c966a29d4930a.zip |
Ensure routing optimizations are cleared when new routes are added [#981 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/lib/action_controller/routing')
-rw-r--r-- | actionpack/lib/action_controller/routing/recognition_optimisation.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_controller/routing/route_set.rb | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/routing/recognition_optimisation.rb b/actionpack/lib/action_controller/routing/recognition_optimisation.rb index 6d54d0334c..306219a431 100644 --- a/actionpack/lib/action_controller/routing/recognition_optimisation.rb +++ b/actionpack/lib/action_controller/routing/recognition_optimisation.rb @@ -147,6 +147,15 @@ module ActionController end }, __FILE__, __LINE__ end + + def clear_recognize_optimized! + instance_eval %{ + def recognize_optimized(path, environment) + write_recognize_optimized! + recognize_optimized(path, environment) + end + }, __FILE__, __LINE__ + end end end end diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb index 9d48f289db..ff448490e9 100644 --- a/actionpack/lib/action_controller/routing/route_set.rb +++ b/actionpack/lib/action_controller/routing/route_set.rb @@ -195,7 +195,7 @@ module ActionController self.routes = [] self.named_routes = NamedRouteCollection.new - write_recognize_optimized! + clear_recognize_optimized! end # Subclasses and plugins may override this method to specify a different @@ -217,7 +217,7 @@ module ActionController @routes_by_controller = nil # This will force routing/recognition_optimization.rb # to refresh optimisations. - @compiled_recognize_optimized = nil + clear_recognize_optimized! end def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false) |