diff options
author | Marcel Molina <marcel@vernix.org> | 2006-04-29 20:34:31 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2006-04-29 20:34:31 +0000 |
commit | aa72c465ec4aa641e9ea161110a43ad9c02d167b (patch) | |
tree | f7b5dcc1e02ae277c6e717f0bc70d902b6a89620 | |
parent | 9f92dd39849c353b8a69401a93ba7b13f93d669f (diff) | |
download | rails-aa72c465ec4aa641e9ea161110a43ad9c02d167b.tar.gz rails-aa72c465ec4aa641e9ea161110a43ad9c02d167b.tar.bz2 rails-aa72c465ec4aa641e9ea161110a43ad9c02d167b.zip |
Replace superfluous name_to_class_name variant with camelize. [Marcel Molina Jr.]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4313 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/aggregations.rb | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 79fdae8b20..7583b72a45 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Replace superfluous name_to_class_name variant with camelize. [Marcel Molina Jr.] + * Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.] * Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.] diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 314c40cfde..3f524f591c 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -128,7 +128,7 @@ module ActiveRecord options.assert_valid_keys(:class_name, :mapping) name = part_id.id2name - class_name = options[:class_name] || name_to_class_name(name) + class_name = options[:class_name] || name.camelize mapping = options[:mapping] || [ name, name ] reader_method(name, class_name, mapping) @@ -138,9 +138,6 @@ module ActiveRecord end private - def name_to_class_name(name) - name.capitalize.gsub(/_(.)/) { |s| $1.capitalize } - end def reader_method(name, class_name, mapping) module_eval <<-end_eval |