Sha256: af81304c0d1f9639684c650871a41fdecd9a4e45606fad2545f1d133d0101482

Contents?: true

Size: 1005 Bytes

Versions: 1

Compression:

Stored size: 1005 Bytes

Contents

begin
  require 'active_support'
  require 'redhillonrails_core'
rescue
  gem 'redhillonrails_core'
  require 'redhillonrails_core'
end

module AutomaticForeignKey
  module ActiveRecord
    autoload :Base, 'automatic_foreign_key/active_record/base'
    autoload :Migration, 'automatic_foreign_key/active_record/migration'

    module ConnectionAdapters
      autoload :TableDefinition, 'automatic_foreign_key/active_record/connection_adapters/table_definition'
    end

  end

  # Default FK update action 
  mattr_accessor :on_update
  
  # Default FK delete action 
  mattr_accessor :on_delete

  # Create an index after creating FK (default false)
  mattr_accessor :auto_index
  @@auto_index = nil


end

ActiveRecord::Base.send(:include, AutomaticForeignKey::ActiveRecord::Base)
ActiveRecord::Migration.send(:include, AutomaticForeignKey::ActiveRecord::Migration)
ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, AutomaticForeignKey::ActiveRecord::ConnectionAdapters::TableDefinition)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
automatic_foreign_key-1.1.0 lib/automatic_foreign_key.rb