Module: ActiveRecord::SimpleIndexName

Defined in:
lib/active_record/simple_index_name.rb,
lib/active_record/simple_index_name/railtie.rb,
lib/active_record/simple_index_name/version.rb,
lib/active_record/simple_index_name/configuration.rb,
lib/active_record/simple_index_name/enable_shorten.rb,
lib/active_record/simple_index_name/disable_shorten.rb

Defined Under Namespace

Modules: DisableShorten, EnableShorten Classes: Configuration, Railtie

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configObject



9
10
11
# File 'lib/active_record/simple_index_name.rb', line 9

def self.config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



13
14
15
# File 'lib/active_record/simple_index_name.rb', line 13

def self.configure
  yield config if block_given?
end

.with_shorten(shorten) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/active_record/simple_index_name.rb', line 17

def self.with_shorten(shorten)
  Thread.current[:simple_index_name_shorten_mode] = shorten

  yield if block_given?
ensure
  Thread.current[:simple_index_name_shorten_mode] = nil
end