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 | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/activerecord/lib/active_record/associations/builder/has_one.rb b/activerecord/lib/active_record/associations/builder/has_one.rb index 2406437a07..064a3c8b51 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 + def self.valid_options(options) valid = super + [:order, :as] valid += [:through, :source, :source_type] if options[:through] valid end - def constructable? - !options[:through] - end - - def configure_dependency - super unless options[:through] + def self.valid_dependent_options + [:destroy, :delete, :nullify, :restrict_with_error, :restrict_with_exception] end - def valid_dependent_options - [:destroy, :delete, :nullify, :restrict_with_error, :restrict_with_exception] + def self.add_before_destroy_callbacks(model, reflection) + super unless reflection.options[:through] end end end |