Sha256: c75395d703cb8e72d1ae0d669f836f7e61bc3030bafc4d922cd052ab283ff80b
Contents?: true
Size: 636 Bytes
Versions: 1
Compression:
Stored size: 636 Bytes
Contents
module FileRecord module AttributeManagement extend ActiveSupport::Concern included do class_attribute :_attribute_names self._attribute_names = [] attr_reader :attributes end def attributes=(attributes) @attributes = attributes sanitize_attributes end def sanitize_attributes @attributes.keep_if do |name, value| self.class._attribute_names.include? name.to_sym end end module ClassMethods def attributes(*attribute_names) self._attribute_names += attribute_names self._attribute_names.uniq! end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
file_record-0.1.0 | lib/file_record/attribute_management.rb |