Sha256: 723327e74f3a64d23bc221e42f4fbcac0a0698afc32d5250fc275109918570ec
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
begin 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' autoload :SchemaStatements, 'automatic_foreign_key/active_record/connection_adapters/schema_statements' 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 def self.setup(&block) yield self end def self.options_for_index(index) index.is_a?(Hash) ? index : {} end 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 end ActiveRecord::Base.send(:include, AutomaticForeignKey::ActiveRecord::Base) ActiveRecord::Migration.send(:include, AutomaticForeignKey::ActiveRecord::Migration) ActiveRecord::ConnectionAdapters::TableDefinition.send(:include, AutomaticForeignKey::ActiveRecord::ConnectionAdapters::TableDefinition) ActiveRecord::ConnectionAdapters::SchemaStatements.send(:include, AutomaticForeignKey::ActiveRecord::ConnectionAdapters::SchemaStatements)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
automatic_foreign_key-1.1.8 | lib/automatic_foreign_key.rb |
automatic_foreign_key-1.1.7 | lib/automatic_foreign_key.rb |