| 192 | | require_dependency(class_id.to_s.demodulize.underscore) |
|---|
| 193 | | if Object.const_defined?(class_id) then return Object.const_get(class_id) else raise LoadError end |
|---|
| 194 | | rescue LoadError => e |
|---|
| 195 | | begin |
|---|
| 196 | | rails_original_const_missing(class_id) |
|---|
| 197 | | rescue Exception |
|---|
| 198 | | raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e) |
|---|
| 199 | | end |
|---|
| | 193 | require_dependency(file_name) |
|---|
| | 194 | raise NameError.new("uninitialized constant #{class_id}") unless Object.const_defined?(class_id) |
|---|
| | 195 | return Object.const_get(class_id) |
|---|
| | 196 | rescue MissingSourceFile => e |
|---|
| | 197 | # Convert the exception to a NameError only if the file we are looking for is the missing one. |
|---|
| | 198 | raise unless e.path == "#{file_name}.rb" |
|---|
| | 199 | raise NameError.new("uninitialized constant #{class_id}").copy_blame!(e) |
|---|