Sha256: 7ae2734ed925945bc606363164da3d16dbed2a959570e6cea677859994b0d9c7
Contents?: true
Size: 522 Bytes
Versions: 1
Compression:
Stored size: 522 Bytes
Contents
class Base extend ActiveModel::Naming include ActiveModel::AttributeMethods include ActiveModel::Serialization def initialize(attributes) @attributes = attributes end def id @id ||= rand(99999999) end # as implemented as in ActiveRecord def to_key key = self.id [key] if key end private def attribute(attr) @attributes[attr.to_sym] end class << self def with_attributes(*attribute_names) define_attribute_methods attribute_names.map(&:to_s) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
styleus-0.0.3 | app/models/base.rb |