diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-12 00:23:07 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-04-12 00:23:07 +0200 |
commit | d1575ae1b9658c91145d6a46ec2a144a5a089207 (patch) | |
tree | d630cd4ba2cd512c3be56e33d4e7b45e0cf8fff4 /activerecord/lib/active_record/associations | |
parent | 5918b868b24ff384365d436367611aea577f3723 (diff) | |
download | rails-d1575ae1b9658c91145d6a46ec2a144a5a089207.tar.gz rails-d1575ae1b9658c91145d6a46ec2a144a5a089207.tar.bz2 rails-d1575ae1b9658c91145d6a46ec2a144a5a089207.zip |
Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion!
Diffstat (limited to 'activerecord/lib/active_record/associations')
5 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index b250783d9e..66f6477ec5 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -164,7 +164,7 @@ module ActiveRecord def creation_attributes attributes = {} - if reflection.macro.either?(:has_one, :has_many) && !options[:through] + if reflection.macro.among?(:has_one, :has_many) && !options[:through] attributes[reflection.foreign_key] = owner[reflection.active_record_primary_key] if reflection.options[:as] diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb index 9ea37da78f..763b12f708 100644 --- a/activerecord/lib/active_record/associations/builder/belongs_to.rb +++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb @@ -67,7 +67,7 @@ module ActiveRecord::Associations::Builder def configure_dependency if options[:dependent] - unless options[:dependent].either?(:destroy, :delete) + unless options[:dependent].among?(:destroy, :delete) raise ArgumentError, "The :dependent option expects either :destroy or :delete (#{options[:dependent].inspect})" end diff --git a/activerecord/lib/active_record/associations/builder/has_many.rb b/activerecord/lib/active_record/associations/builder/has_many.rb index 3b489d9647..67ce339380 100644 --- a/activerecord/lib/active_record/associations/builder/has_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_many.rb @@ -16,7 +16,7 @@ module ActiveRecord::Associations::Builder def configure_dependency if options[:dependent] - unless options[:dependent].either?(:destroy, :delete_all, :nullify, :restrict) + unless options[:dependent].among?(:destroy, :delete_all, :nullify, :restrict) raise ArgumentError, "The :dependent option expects either :destroy, :delete_all, " \ ":nullify or :restrict (#{options[:dependent].inspect})" end diff --git a/activerecord/lib/active_record/associations/builder/has_one.rb b/activerecord/lib/active_record/associations/builder/has_one.rb index 7efe2ec74d..18d7117bb7 100644 --- a/activerecord/lib/active_record/associations/builder/has_one.rb +++ b/activerecord/lib/active_record/associations/builder/has_one.rb @@ -29,7 +29,7 @@ module ActiveRecord::Associations::Builder def configure_dependency if options[:dependent] - unless options[:dependent].either?(:destroy, :delete, :nullify, :restrict) + unless options[:dependent].among?(:destroy, :delete, :nullify, :restrict) raise ArgumentError, "The :dependent option expects either :destroy, :delete, " \ ":nullify or :restrict (#{options[:dependent].inspect})" end diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 82f5696ad8..aaa8b97389 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -52,7 +52,7 @@ module ActiveRecord end def remove_target!(method) - if method.either?(:delete, :destroy) + if method.among?(:delete, :destroy) target.send(method) else nullify_owner_attributes(target) |