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, limit: nil) ⇒ Object



166
167
168
# File 'lib/switchman/engine.rb', line 166

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) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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