diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-09-08 19:42:20 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-09-08 19:42:20 -0700 |
commit | fd71a1a354f96a74556346920ff61e80b91d8af0 (patch) | |
tree | 79eb944b06c2970ac6f0ea45183df40a5e2ce99a /actionpack/lib/action_controller/routing | |
parent | 3c658512a1fb561743bf626b9655c86765510f06 (diff) | |
download | rails-fd71a1a354f96a74556346920ff61e80b91d8af0.tar.gz rails-fd71a1a354f96a74556346920ff61e80b91d8af0.tar.bz2 rails-fd71a1a354f96a74556346920ff61e80b91d8af0.zip |
Remove recognized_optimized method before redefining it
Diffstat (limited to 'actionpack/lib/action_controller/routing')
-rw-r--r-- | actionpack/lib/action_controller/routing/recognition_optimisation.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/routing/recognition_optimisation.rb b/actionpack/lib/action_controller/routing/recognition_optimisation.rb index 306219a431..4935432d87 100644 --- a/actionpack/lib/action_controller/routing/recognition_optimisation.rb +++ b/actionpack/lib/action_controller/routing/recognition_optimisation.rb @@ -134,6 +134,9 @@ module ActionController def write_recognize_optimized! tree = segment_tree(routes) body = generate_code(tree) + + remove_recognize_optimized! + instance_eval %{ def recognize_optimized(path, env) segments = to_plain_segments(path) @@ -149,12 +152,22 @@ module ActionController end def clear_recognize_optimized! - instance_eval %{ + remove_recognize_optimized! + + class << self def recognize_optimized(path, environment) write_recognize_optimized! recognize_optimized(path, environment) end - }, __FILE__, __LINE__ + end + end + + def remove_recognize_optimized! + if respond_to?(:recognize_optimized) + class << self + remove_method :recognize_optimized + end + end end end end |