diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/builder/has_one.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/has_one.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/associations/builder/has_one.rb b/activerecord/lib/active_record/associations/builder/has_one.rb index 0da564f402..64e9e6b334 100644 --- a/activerecord/lib/active_record/associations/builder/has_one.rb +++ b/activerecord/lib/active_record/associations/builder/has_one.rb @@ -1,25 +1,21 @@ module ActiveRecord::Associations::Builder class HasOne < SingularAssociation #:nodoc: - def macro + def self.macro :has_one end - def valid_options - valid = super + [:order, :as] + def self.valid_options(options) + valid = super + [:as, :foreign_type] valid += [:through, :source, :source_type] if options[:through] valid end - def constructable? - !options[:through] + def self.valid_dependent_options + [:destroy, :delete, :nullify, :restrict_with_error, :restrict_with_exception] end - def configure_dependency - super unless options[:through] - end - - def valid_dependent_options - [:destroy, :delete, :nullify, :restrict, :restrict_with_error, :restrict_with_exception] + def self.add_destroy_callbacks(model, reflection) + super unless reflection.options[:through] end end end |