Class: Switchman::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/switchman/engine.rb

Class Method Summary collapse

Class Method Details

.foreign_key_check(name, type, options) ⇒ Object



153
154
155
156
157
# File 'lib/switchman/engine.rb', line 153

def self.foreign_key_check(name, type, options)
  if name.to_s =~ /_id\z/ && type.to_s == 'integer' && options[:limit].to_i < 8
    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`"
  end
end

.lookup_stores(cache_store_config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/switchman/engine.rb', line 7

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|
    next unless value.is_a?(String)
    result[key] = result[value]
  end
  result
end