class Switchman::Engine

Public Class Methods

foreign_key_check(name, type, limit: nil) click to toggle source
# File lib/switchman/engine.rb, line 167
def self.foreign_key_check(name, type, limit: nil)
  puts "WARNING: All foreign keys need to be 8-byte integers. #{name} looks like a foreign key. If so, please add the option: `:limit => 8`" if name.to_s =~ /_id\z/ && type.to_s == 'integer' && limit.to_i < 8
end
lookup_stores(cache_store_config) click to toggle source
# File lib/switchman/engine.rb, line 13
def self.lookup_stores(cache_store_config)
  result = {}
  cache_store_config.each do |key, value|
    next if value.is_a?(String)

    result[key] = ::ActiveSupport::Cache.lookup_store(value)
  end

  cache_store_config.each do |key, value| # rubocop:disable Style/CombinableLoops
    next unless value.is_a?(String)

    result[key] = result[value]
  end
  result
end