Sha256: 740c3d3e39874e1eecbcb1575f5a5e20d99424b013f39f6cc0c03ddbdff901cf
Contents?: true
Size: 763 Bytes
Versions: 33
Compression:
Stored size: 763 Bytes
Contents
module ActiveFedora::Associations::Builder class SingularAssociation < Association #:nodoc: self.valid_options += [:dependent, :inverse_of] def self.constructable? true end def self.define_accessors(model, reflection) super define_constructors(model.generated_association_methods, reflection.name) if 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
33 entries across 33 versions & 1 rubygems