diff options
author | kennyj <kennyj@gmail.com> | 2013-09-28 12:23:58 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2013-09-28 12:26:23 +0900 |
commit | 8e814a0ac0768816974d2bfd68d33d931592751e (patch) | |
tree | e293b073839899f8b2e639b7f524605515f41bf4 | |
parent | 3e0a60e4e2316ee696bdcf1c115582f8f450ad07 (diff) | |
download | rails-8e814a0ac0768816974d2bfd68d33d931592751e.tar.gz rails-8e814a0ac0768816974d2bfd68d33d931592751e.tar.bz2 rails-8e814a0ac0768816974d2bfd68d33d931592751e.zip |
Renamed generated_feature_methods to generated_association_methods.
5 files changed, 12 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index 1059fc032d..17b74b197e 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -83,7 +83,7 @@ module ActiveRecord::Associations::Builder # Post.first.comments and Post.first.comments= methods are defined by this method... def define_accessors(model) - mixin = model.generated_feature_methods + mixin = model.generated_association_methods define_readers(mixin) define_writers(mixin) end diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb index d97c0e9afd..e81cc99278 100644 --- a/activerecord/lib/active_record/associations/builder/singular_association.rb +++ b/activerecord/lib/active_record/associations/builder/singular_association.rb @@ -12,7 +12,7 @@ module ActiveRecord::Associations::Builder def define_accessors(model) super - define_constructors(model.generated_feature_methods) if constructable? + define_constructors(model.generated_association_methods) if constructable? end # Defines the (build|create)_association methods for belongs_to or has_one association diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 366ebde418..0167ddb5e5 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -91,12 +91,12 @@ module ActiveRecord def initialize_generated_modules super - generated_feature_methods + generated_association_methods end - def generated_feature_methods - @generated_feature_methods ||= begin - mod = const_set(:GeneratedFeatureMethods, Module.new) + def generated_association_methods + @generated_association_methods ||= begin + mod = const_set(:GeneratedAssociationMethods, Module.new) include mod mod end diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index df28451bb7..9d92e747d4 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -335,7 +335,7 @@ module ActiveRecord # the helper methods defined below. Makes it seem like the nested # associations are just regular associations. def generate_association_writer(association_name, type) - generated_feature_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1 + generated_association_methods.module_eval <<-eoruby, __FILE__, __LINE__ + 1 if method_defined?(:#{association_name}_attributes=) remove_method(:#{association_name}_attributes=) end diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 5812e20a1b..15827133a8 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -86,11 +86,11 @@ class BasicsTest < ActiveRecord::TestCase def test_generated_methods_modules modules = Computer.ancestors - assert modules.include?(Computer::GeneratedFeatureMethods) - assert_equal(Computer::GeneratedFeatureMethods, Computer.generated_feature_methods) - assert(modules.index(Computer.generated_attribute_methods) > modules.index(Computer.generated_feature_methods), - "generated_attribute_methods must be higher in inheritance hierarchy than generated_feature_methods") - assert_not_equal Computer.generated_feature_methods, Post.generated_feature_methods + assert modules.include?(Computer::GeneratedAssociationMethods) + assert_equal(Computer::GeneratedAssociationMethods, Computer.generated_association_methods) + assert(modules.index(Computer.generated_attribute_methods) > modules.index(Computer.generated_association_methods), + "generated_attribute_methods must be higher in inheritance hierarchy than generated_association_methods") + assert_not_equal Computer.generated_association_methods, Post.generated_association_methods assert(modules.index(Computer.generated_attribute_methods) < modules.index(ActiveRecord::Base.ancestors[1])) end |