module ActiveRecord::ModelSpaces

Constants

MODEL_REGISTRATION_KEYS
REGISTRY

Attributes

connection[RW]
table_name[RW]

Public Class Methods

included(mod) click to toggle source
# File lib/active_record/model_spaces.rb, line 18
def self.included(mod)
  class << mod
    include ClassMethods
  end
end

Public Instance Methods

active_key(model_space_name) click to toggle source
# File lib/active_record/model_spaces.rb, line 30
def active_key(model_space_name)
  REGISTRY.active_key(model_space_name)
end
check_model_registration_keys(keys) click to toggle source
# File lib/active_record/model_spaces/model_space.rb, line 109
def check_model_registration_keys(keys)
  unknown_keys = (keys.map(&:to_sym).to_set - MODEL_REGISTRATION_KEYS).to_a
  raise "unknown keys: #{unknown_keys.inspect}" if !unknown_keys.empty?
end
create_persistor() click to toggle source

get a persistor given a connection… returns an instance of ActiveRecord::ModelSpaces::AdapterNamePersistor

# File lib/active_record/model_spaces/model_space.rb, line 116
def create_persistor
  Persistor.new(ModelSpaces.connection || ActiveRecord::Base.connection, ModelSpaces.table_name)
end
enforce_context() click to toggle source
# File lib/active_record/model_spaces.rb, line 38
def enforce_context
  REGISTRY.enforce_context
end
kill_context(model_space_name, model_space_key) click to toggle source
# File lib/active_record/model_spaces.rb, line 34
def kill_context(model_space_name, model_space_key)
  REGISTRY.kill_context(model_space_name, model_space_key)
end
set_enforce_context(ec) click to toggle source
# File lib/active_record/model_spaces.rb, line 42
def set_enforce_context(ec)
  REGISTRY.set_enforce_context(ec)
end
with_context(model_space_name, model_space_key, &block) click to toggle source
# File lib/active_record/model_spaces.rb, line 26
def with_context(model_space_name, model_space_key, &block)
  REGISTRY.with_context(model_space_name, model_space_key, &block)
end