Sha256: c5ef04d2ec3cb4e0b6f66d800faa5a735549ad1a1855860f160203c0024ca035
Contents?: true
Size: 738 Bytes
Versions: 33
Compression:
Stored size: 738 Bytes
Contents
module ActiveFedora::Associations::Builder class SingularAssociation < Association #:nodoc: self.valid_options += [:dependent, :counter_cache, :inverse_of] def constructable? true end def define_accessors super define_constructors if constructable? end private def define_constructors name = self.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