Sha256: c0a53cbf2c9ac9512fe91e34ab60ed3161d3d3a30d1abc2d15cc912deb77aefd
Contents?: true
Size: 700 Bytes
Versions: 1
Compression:
Stored size: 700 Bytes
Contents
module Recliner module AttributeMethods module Defaults extend ActiveSupport::Concern included do alias_method_chain :initialize, :defaults end def initialize_with_defaults(attributes={}, &block)#:nodoc: default_attributes.each do |property, default| write_attribute(property, default) end initialize_without_defaults(attributes, &block) end private def default_attributes result = {} properties.each do |name, property| result[name] = property.default_value(self) unless name == :rev end result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
recliner-0.0.1 | lib/recliner/attribute_methods/defaults.rb |