module Octopus::Model::SharedMethods

Public Instance Methods

clean_table_name() click to toggle source
# File lib/octopus/model.rb, line 12
def clean_table_name
  return unless connection_proxy.should_clean_table_name?

  if self != ActiveRecord::Base && self.respond_to?(:reset_table_name) && !custom_octopus_table_name
    reset_table_name
  end

  reset_column_information
  instance_variable_set(:@quoted_table_name, nil)
end
using(shard) click to toggle source
# File lib/octopus/model.rb, line 23
      def using(shard)
        if block_given?
          raise Octopus::Exception, <<-EOF
#{name}.using is not allowed to receive a block, it works just like a regular scope.

If you are trying to scope everything to a specific shard, use Octopus.using instead.
          EOF
        end

        if Octopus.enabled?
          clean_table_name
          Octopus::ScopeProxy.new(shard, self)
        else
          self
        end
      end