Sha256: 0f1b6052d6ab0b41b7accc5ca1ec779672d7c645c9fc747eb9ecd47d1f675ea4

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

require 'active_model/callbacks'
require 'active_attr/model'

require 'active_remote/association'
require 'active_remote/attributes'
require 'active_remote/bulk'
require 'active_remote/config'
require 'active_remote/dirty'
require 'active_remote/dsl'
require 'active_remote/integration'
require 'active_remote/persistence'
require 'active_remote/primary_key'
require 'active_remote/publication'
require 'active_remote/rpc'
require 'active_remote/scope_keys'
require 'active_remote/search'
require 'active_remote/serialization'

module ActiveRemote
  class Base
    extend ActiveModel::Callbacks

    include ActiveAttr::Model

    include Association
    include Attributes
    include Bulk
    include DSL
    include Integration
    include Persistence
    include PrimaryKey
    include Publication
    include RPC
    include ScopeKeys
    include Search
    include Serialization

    # Overrides some methods, providing support for dirty tracking,
    # so it needs to be included last.
    include Dirty

    attr_reader :last_request, :last_response

    define_model_callbacks :initialize, :only => :after

    def initialize(*)
      @attributes ||= {}
      @new_record = true

      skip_dirty_tracking do
        run_callbacks :initialize do
          super
        end
      end
    end

    def freeze
      @attributes.freeze; self
    end

    def frozen?
      @attributes.frozen?
    end
  end

  ActiveSupport.run_load_hooks(:active_remote, Base)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_remote-2.1.1 lib/active_remote/base.rb
active_remote-2.1.0 lib/active_remote/base.rb
active_remote-2.1.0.rc2 lib/active_remote/base.rb
active_remote-2.1.0.rc1 lib/active_remote/base.rb
active_remote-2.1.0.beta2 lib/active_remote/base.rb
active_remote-2.1.0.beta1 lib/active_remote/base.rb