Module: Switchman::ActiveRecord::AttributeMethods

Defined in:
lib/switchman/active_record/attribute_methods.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



131
132
133
134
# File 'lib/switchman/active_record/attribute_methods.rb', line 131

def self.included(klass)
  klass.singleton_class.include(ClassMethods)
  klass.attribute_method_prefix 'global_', 'local_', 'original_'
end

Instance Method Details

#idObject

ensure that we’re using the sharded attribute method and not the silly one in AR::AttributeMethods::PrimaryKey



138
139
140
141
142
143
# File 'lib/switchman/active_record/attribute_methods.rb', line 138

def id
  return super if is_a?(Shard)

  self.class.define_attribute_methods
  super
end