Permalink
Browse files

Regression test for irregular inflection on has_many

Also add a Changelog entry

[related #9702]
[fixes #8928]
  • Loading branch information...
1 parent bcfa2bf commit c0b6e164ee6bbc7941d280ea629d70d400561668 @arthurnn arthurnn committed Apr 18, 2014
Showing with 14 additions and 0 deletions.
  1. +6 −0 activerecord/CHANGELOG.md
  2. +8 −0 activerecord/test/cases/reflection_test.rb
@@ -1,3 +1,9 @@
+* Fixed has_many association to make it support irregular inflections.
+
+ Fixes #8928.
+
+ *arthurnn*, *Javier Goizueta*
+
* Fixed a problem where count used with a grouping was not returning a Hash.
Fixes #14721.
@@ -87,6 +87,14 @@ def test_reflection_klass_for_nested_class_name
end
end
+ def test_irregular_reflection_class_name
+ ActiveSupport::Inflector.inflections do |inflect|
+ inflect.irregular 'plural_irregular', 'plurales_irregulares'
+ end
+ reflection = AssociationReflection.new(:has_many, 'plurales_irregulares', nil, {}, ActiveRecord::Base)
+ assert_equal 'PluralIrregular', reflection.class_name
+ end
+
def test_aggregation_reflection
reflection_for_address = AggregateReflection.new(
:composed_of, :address, nil, { :mapping => [ %w(address_street street), %w(address_city city), %w(address_country country) ] }, Customer

0 comments on commit c0b6e16

Please sign in to comment.