Sha256: 0b65a7a0dfbe862f8fbcb3f6a7c0d0be6d276bf6ef6fda14794cf2e46197d9b0

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

require "curly_mustache/default_types"

module CurlyMustache
  class Base
    
    include Connection
    include Attributes
    include Crud
    
    extend ActiveModel::Callbacks
    include ActiveModel::Validations
    include ActiveModel::Dirty
    
    define_model_callbacks :create, :destroy, :save, :update, :validation, :validation_on_create, :validation_on_update, :only => [:before, :after]
    define_model_callbacks :find, :only => :after
    
    # Set this to true if you want to set your own ids as opposed to having CurlyMustache
    # automatically generate them for you.  Ex:
    #   class User
    #     self.allow_settable_id = true
    #     attribute :name, :string
    #   end
    #   User.create(:id => 123, :name => "blah")
    #   User.find(123)
    allow_settable_id!(false)
    
    attribute :id, :string
    
    def ==(other)
      self.attributes  == other.attributes and
      self.new_record? == other.new_record?
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curly_mustache-0.1.0 lib/curly_mustache/base.rb