Sha256: bc0a30570ad80d819848dbfce0148983cffdd74f2a84d759cf21932e46dd9641
Contents?: true
Size: 740 Bytes
Versions: 3
Compression:
Stored size: 740 Bytes
Contents
# # See http://railscasts.com/episodes/219-active-model # class ValidateableModel # Mixin validation include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming def self.attr_accessor(*vars) @attributes ||= [] @attributes.concat( vars ) super end def self.attributes @attributes end # Initializer def initialize(attributes={}) attributes && attributes.each do |name, value| send("#{name}=", value) if respond_to? name.to_sym end end # Overload persisted? def persisted? false end # Inspect def self.inspect "#<#{ self.to_s} #{ self.attributes.collect{ |e| ":#{ e }" }.join(', ') }>" end end
Version data entries
3 entries across 3 versions & 1 rubygems