Sha256: 9b9f1356975d2cd7edfe144eff289614c512a1b8bfab477cf446708d276631e1
Contents?: true
Size: 768 Bytes
Versions: 70
Compression:
Stored size: 768 Bytes
Contents
module ActiveFedora::Associations::Builder class SingularAssociation < Association #:nodoc: def self.valid_options(options) super + [:dependent, :inverse_of, :required] end def self.define_accessors(model, reflection) super define_constructors(model.generated_association_methods, reflection.name) if reflection.constructable? end def self.define_constructors(mixin, name) mixin.redefine_method("build_#{name}") do |*params| association(name).build(*params) end mixin.redefine_method("create_#{name}") do |*params| association(name).create(*params) end mixin.redefine_method("create_#{name}!") do |*params| association(name).create!(*params) end end end end
Version data entries
70 entries across 70 versions & 1 rubygems