Changeset 817
- Timestamp:
- 03/01/05 02:04:54 (4 years ago)
- Files:
-
- trunk/actionpack/lib/action_controller/request.rb (modified) (1 diff)
- trunk/actionpack/test/controller/request_test.rb (modified) (1 diff)
- trunk/activesupport/lib/active_support/dependencies.rb (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/request.rb
r802 r817 79 79 80 80 def path_info 81 env['PATH_INFO']81 (/^(.*)\.html$/ =~ env['PATH_INFO']) ? $1 : env['PATH_INFO'] 82 82 end 83 83 trunk/actionpack/test/controller/request_test.rb
r802 r817 59 59 assert_equal "/path/of/some/uri", @request.path_info 60 60 assert_equal "/path/of/some/uri", @request.path 61 62 # PATH_INFO actually has a .html suffix on many servers. But we don't want Rails to see the .html part. 63 @request.env["PATH_INFO"] = "/path/of/some/uri.html" 64 assert_equal "/path/of/some/uri", @request.path_info 65 assert_equal "/path/of/some/uri", @request.path 61 66 end 62 67 trunk/activesupport/lib/active_support/dependencies.rb
r718 r817 37 37 38 38 def require_or_load(file_name) 39 load? ? load("#{file_name}.rb") : require(file_name) 39 file_name = "#{file_name}.rb" unless ! load? || /\.rb$/ =~ file_name 40 load? ? load(file_name) : require(file_name) 40 41 end 41 42 … … 63 64 end 64 65 66 def root?() self.root == self end 65 67 def load_paths() self.root.load_paths end 66 68 … … 79 81 80 82 if File.directory?(fs_path) 81 self.const_set name, LoadingModule.new(self.root, self.path + [name]) 83 new_module = LoadingModule.new(self.root, self.path + [name]) 84 self.const_set name, new_module 85 if self.root? 86 raise NameError, "Cannot load controller module named #{name}: An object of type #{Object.const_get(name).class.to_s} already exists." \ 87 if Object.const_defined?(name) 88 Object.const_set(name, new_module) 89 end 82 90 break 83 91 elsif File.file?(fs_path) 84 92 self.root.load_file!(fs_path) 93 94 # Import the loaded constant from Object provided we are the root node. 95 self.const_set(name, Object.const_get(name)) if self.root? && Object.const_defined?(name) 85 96 break 86 97 end … … 110 121 # Load the source file at the given file path 111 122 def load_file!(file_path) 112 begin root.module_eval(IO.read(file_path), file_path, 1) 113 rescue Object => exception 114 exception.blame_file! file_path 115 raise 116 end 123 require_dependency(file_path) 117 124 end 118 125 … … 120 127 def clear! 121 128 constants.each do |name| 122 Object.send(:remove_const, name) if Object.const_defined?(name) && self.path.empty?129 Object.send(:remove_const, name) if Object.const_defined?(name) 123 130 self.send(:remove_const, name) 124 131 end