Sha256: 54d3ca004b2c50d9a8869b47201cced714d8079cfd58df3551f67b0391cb38b2
Contents?: true
Size: 653 Bytes
Versions: 5
Compression:
Stored size: 653 Bytes
Contents
module GreyscaleRecord module Instanceable extend ActiveSupport::Concern included do include ActiveModel::Model def method_missing( method, *args, &block ) if @attributes.has_key? method method = @attributes[method] else raise GreyscaleRecord::Errors::InvalidFieldError, "#{self.class}:#{@attributes[:id]}: Invalid field: '#{method}'" end end protected # public init really doesn't make sense for a read-only interface def initialize( attrs = {} ) @attributes = self.class.__properties.merge( attrs ).with_indifferent_access end end end end
Version data entries
5 entries across 5 versions & 1 rubygems