Module: AutomaticForeignKey

Defined in:
lib/automatic_foreign_key.rb,
lib/automatic_foreign_key/version.rb,
lib/generators/automatic_foreign_key/install_generator.rb,
lib/generators/automatic_foreign_key/migration_generator.rb

Defined Under Namespace

Modules: ActiveRecord, Generators

Constant Summary collapse

VERSION =
"1.3.0"
@@auto_index =
nil

Class Method Summary collapse

Class Method Details

.options_for_index(index) ⇒ Object



41
42
43
# File 'lib/automatic_foreign_key.rb', line 41

def self.options_for_index(index)
  index.is_a?(Hash) ? index : {}
end

.set_default_update_and_delete_actions!(options) ⇒ Object



45
46
47
48
# File 'lib/automatic_foreign_key.rb', line 45

def self.set_default_update_and_delete_actions!(options)
  options[:on_update] = options.fetch(:on_update, AutomaticForeignKey.on_update)
  options[:on_delete] = options.fetch(:on_delete, AutomaticForeignKey.on_delete)
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



37
38
39
# File 'lib/automatic_foreign_key.rb', line 37

def self.setup(&block)
  yield self
end