diff options
author | Eileen M. Uchitelle <eileencodes@gmail.com> | 2016-01-23 11:48:41 -0500 |
---|---|---|
committer | Eileen M. Uchitelle <eileencodes@gmail.com> | 2016-01-23 11:48:41 -0500 |
commit | 75a8973c7afbc43d48939942247d27feb0738770 (patch) | |
tree | f2bbdacc7074841fbd780fec2d22119f0bfa71be /activerecord | |
parent | 67c1719012506c3387df067961252b5df50a97ce (diff) | |
parent | 86efab1b9cac7b824ea950f5a920e054953e6732 (diff) | |
download | rails-75a8973c7afbc43d48939942247d27feb0738770.tar.gz rails-75a8973c7afbc43d48939942247d27feb0738770.tar.bz2 rails-75a8973c7afbc43d48939942247d27feb0738770.zip |
Merge pull request #23102 from yui-knk/foreign_type_to_singular_association
Define `:foreign_type` as a valid option in `SingularAssociation`
Diffstat (limited to 'activerecord')
3 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb index f02d146e89..346329c610 100644 --- a/activerecord/lib/active_record/associations/builder/belongs_to.rb +++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb @@ -5,7 +5,7 @@ module ActiveRecord::Associations::Builder # :nodoc: end def self.valid_options(options) - super + [:foreign_type, :polymorphic, :touch, :counter_cache, :optional] + super + [:polymorphic, :touch, :counter_cache, :optional] end def self.valid_dependent_options diff --git a/activerecord/lib/active_record/associations/builder/has_one.rb b/activerecord/lib/active_record/associations/builder/has_one.rb index 9d64ae877b..4de846d12b 100644 --- a/activerecord/lib/active_record/associations/builder/has_one.rb +++ b/activerecord/lib/active_record/associations/builder/has_one.rb @@ -5,7 +5,7 @@ module ActiveRecord::Associations::Builder # :nodoc: end def self.valid_options(options) - valid = super + [:as, :foreign_type] + valid = super + [:as] valid += [:through, :source, :source_type] if options[:through] valid end diff --git a/activerecord/lib/active_record/associations/builder/singular_association.rb b/activerecord/lib/active_record/associations/builder/singular_association.rb index 58a9c8ff24..bb96202a22 100644 --- a/activerecord/lib/active_record/associations/builder/singular_association.rb +++ b/activerecord/lib/active_record/associations/builder/singular_association.rb @@ -3,7 +3,7 @@ module ActiveRecord::Associations::Builder # :nodoc: class SingularAssociation < Association #:nodoc: def self.valid_options(options) - super + [:dependent, :primary_key, :inverse_of, :required] + super + [:foreign_type, :dependent, :primary_key, :inverse_of, :required] end def self.define_accessors(model, reflection) |