Permalink
Browse files

Dont use evals in backtraces #1513

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1531 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 264a7e7 commit c19b74d9a6776596144b0a2d96e5795785866f40 @dhh dhh committed Jun 27, 2005
Showing with 8 additions and 6 deletions.
  1. +8 −6 actionpack/lib/action_controller/routing.rb
@@ -217,9 +217,9 @@ def traverse_to_controller(segments, start_at = 0)
mod_name = segment.camelize
controller_name = "#{mod_name}Controller"
- return eval("mod::#{controller_name}"), (index - start_at) if mod.const_available?(controller_name)
+ return eval("mod::#{controller_name}", nil, 'routing.rb', __LINE__), (index - start_at) if mod.const_available?(controller_name)
return nil unless mod.const_available?(mod_name)
- mod = eval("mod::#{mod_name}")
+ mod = eval("mod::#{mod_name}", nil, 'routing.rb', __LINE__)
end
end
end
@@ -394,13 +394,15 @@ def write_generation
method_name = "generate_path_for_#{ivar}".to_sym
instance_variable_set "@#{ivar}", routes
code = generation_code_for(ivar, method_name).to_s
- eval(code)
+
+ filename = "generated_code/routing/generation_for_controller_#{controller}.rb"
+ eval(code, nil, filename)
@generation_methods[controller.to_s] = method_name
@generation_methods[controller.to_sym] = method_name
end
- eval(generation_code_for('routes', 'generate_default_path').to_s)
+ eval(generation_code_for('routes', 'generate_default_path').to_s, nil, 'generated_code/routing/generation.rb')
end
def recognize(request)
@@ -434,7 +436,7 @@ def write_recognition
end
end
- eval g.to_s
+ eval g.to_s, nil, 'generated/routing/recognition.rb'
end
def generation_code_for(ivar = 'routes', method_name = nil)
@@ -563,7 +565,7 @@ def name_route(route, name)
define_method(hash_access_name(name)) { hash }
module_eval(%{def #{url_helper_name name}(options = {})
url_for(#{hash_access_name(name)}.merge(options))
- end})
+ end}, nil, "generated/routing/named_routes/#{name}.rb")
protected url_helper_name(name), hash_access_name(name)

0 comments on commit c19b74d

Please sign in to comment.