aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/inheritance.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-07-18 23:42:31 +0930
committerMatthew Draper <matthew@trebex.net>2014-07-18 23:42:31 +0930
commit843b8c0b8c8cccd8d1432060dfc79a8edcc4ed2c (patch)
treec3b8ec1d8a1ee6d401246af4ec10e4a97ebd6851 /activerecord/lib/active_record/inheritance.rb
parentba9fe6cf90c12e3f81861e795b1c7299c3315b74 (diff)
parentc965de396f1bd7457159306f1fc10342840fdf86 (diff)
downloadrails-843b8c0b8c8cccd8d1432060dfc79a8edcc4ed2c.tar.gz
rails-843b8c0b8c8cccd8d1432060dfc79a8edcc4ed2c.tar.bz2
rails-843b8c0b8c8cccd8d1432060dfc79a8edcc4ed2c.zip
Merge pull request #15762 from arthurnn/better_error_on_bad_alias_method
Dont swallow errors when bad alias_method
Diffstat (limited to 'activerecord/lib/active_record/inheritance.rb')
-rw-r--r--activerecord/lib/active_record/inheritance.rb10
1 files changed, 2 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index f6c265a6d6..251d682a02 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -151,14 +151,8 @@ module ActiveRecord
candidates << type_name
candidates.each do |candidate|
- begin
- constant = ActiveSupport::Dependencies.constantize(candidate)
- return constant if candidate == constant.to_s
- # We don't want to swallow NoMethodError < NameError errors
- rescue NoMethodError
- raise
- rescue NameError
- end
+ constant = ActiveSupport::Dependencies.safe_constantize(candidate)
+ return constant if candidate == constant.to_s
end
raise NameError.new("uninitialized constant #{candidates.first}", candidates.first)