Changeset 4456
- Timestamp:
- 06/18/06 04:39:42 (2 years ago)
- Files:
-
- branches/stable/actionpack/CHANGELOG (modified) (1 diff)
- branches/stable/actionpack/lib/action_controller/routing.rb (modified) (1 diff)
- branches/stable/actionpack/test/controller/routing_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/stable/actionpack/CHANGELOG
r4189 r4456 1 1 *1.12.1* (April 6th, 2005) 2 3 * (Hackish) Fix loading of arbitrary files in Ruby's load path by traverse_to_controller. [Nicholas Seckar] 2 4 3 5 * Fixed that template extensions would be cached development mode #4624 [Stefan Kaes] branches/stable/actionpack/lib/action_controller/routing.rb
r3893 r4456 246 246 end 247 247 248 begin 249 next_mod = eval("mod::#{mod_name}", nil, __FILE__, __LINE__) 250 # Check that we didn't get a module from a parent namespace 251 mod = (mod == Object || next_mod.name == "#{mod.name}::#{mod_name}") ? next_mod : nil 252 rescue NameError => e 253 raise unless /^uninitialized constant .*#{mod_name}$/ =~ e.message 254 end 248 if mod.const_defined? mod_name 249 next_mod = mod.send(:const_get, mod_name) 250 else 251 suffix = File.join(segments[start_at..index]) 252 $:.each do |base| 253 path = File.join(base, suffix) 254 next unless File.directory? path 255 next_mod = Module.new 256 mod.send(:const_set, mod_name, next_mod) 257 break 258 end 259 end 260 mod = next_mod 255 261 256 262 return nil unless mod branches/stable/actionpack/test/controller/routing_test.rb
r3542 r4456 535 535 536 536 class RouteTests < Test::Unit::TestCase 537 538 537 539 538 def route(*args) … … 973 972 end 974 973 974 class ControllerComponentTest < Test::Unit::TestCase 975 976 def test_traverse_to_controller_should_not_load_arbitrary_files 977 load_path = $:.dup 978 base = File.dirname(File.dirname(File.expand_path(__FILE__))) 979 $: << File.join(base, 'fixtures') 980 assert_equal nil, ActionController::Routing::ControllerComponent.traverse_to_controller(%w(dont_load pretty please)) 981 ensure 982 $:[0..-1] = load_path 983 end 984 975 985 end 986 987 end