diff options
author | Arthur Neves <arthurnn@gmail.com> | 2014-06-16 18:25:09 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2014-06-24 11:31:43 -0400 |
commit | c965de396f1bd7457159306f1fc10342840fdf86 (patch) | |
tree | aac623c186c704db7fbf1644596ab7751581b1ae /activerecord/lib | |
parent | a1bd00d5be4f5bef34a259a053a00edede2cd2b5 (diff) | |
download | rails-c965de396f1bd7457159306f1fc10342840fdf86.tar.gz rails-c965de396f1bd7457159306f1fc10342840fdf86.tar.bz2 rails-c965de396f1bd7457159306f1fc10342840fdf86.zip |
Dont swallow errors when bad alias_method
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/inheritance.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index 08fc91c9df..17cec08628 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -120,14 +120,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) |