module Protector::Adapters::ActiveRecord::SingularAssociation
Patches ‘ActiveRecord::Associations::SingularAssociation`
Public Instance Methods
build_record_with_protector(*args)
click to toggle source
Forwards protection subject to the new instance
# File lib/protector/adapters/active_record/singular_association.rb, line 20 def build_record_with_protector(*args) return build_record_without_protector(*args) unless protector_subject? build_record_without_protector(*args).restrict!(protector_subject) end
reader_with_protector(*args)
click to toggle source
Reader has to be explicitly overrided for cases when the loaded association is cached
# File lib/protector/adapters/active_record/singular_association.rb, line 14 def reader_with_protector(*args) return reader_without_protector(*args) unless protector_subject? reader_without_protector(*args).try :restrict!, protector_subject end