Sha256: 3a35462ac63d03f01891895fa2724ee49652e9f24123af737d74e16af4faac39
Contents?: true
Size: 762 Bytes
Versions: 11
Compression:
Stored size: 762 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
11 entries across 11 versions & 1 rubygems