Browse files

Remove recognized_optimized method before redefining it

  • Loading branch information...
1 parent 3c65851 commit fd71a1a354f96a74556346920ff61e80b91d8af0 @jeremy jeremy committed Sep 8, 2008
Showing with 15 additions and 2 deletions.
  1. +15 −2 actionpack/lib/action_controller/routing/recognition_optimisation.rb
View
17 actionpack/lib/action_controller/routing/recognition_optimisation.rb
@@ -134,6 +134,9 @@ def to_plain_segments(str)
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 @@ def recognize_optimized(path, env)
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

0 comments on commit fd71a1a

Please sign in to comment.