Skip to content
Browse files

Merge branch 'master' of github.com:matthuhiggins/foreigner

  • Loading branch information...
2 parents a38cf22 + 05f4ba3 commit 53c6ca0c67585cdb477943edb9af3e33fdd09f87 Matthew Higgins committed Mar 9, 2012
Showing with 24 additions and 17 deletions.
  1. +1 −1 foreigner.gemspec
  2. +2 −0 lib/foreigner.rb
  3. +20 −0 lib/foreigner/loader.rb
  4. +1 −16 lib/foreigner/railtie.rb
View
2 foreigner.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
s.name = 'foreigner'
- s.version = '1.1.2'
+ s.version = '1.1.4'
s.summary = 'Foreign Keys for Rails'
s.description = 'Adds helpers to migrations and dumps foreign keys to schema.rb'
View
2 lib/foreigner.rb
@@ -24,5 +24,7 @@ module Migration
Foreigner::Adapter.register 'mysql2', 'foreigner/connection_adapters/mysql2_adapter'
Foreigner::Adapter.register 'jdbcmysql', 'foreigner/connection_adapters/mysql2_adapter'
Foreigner::Adapter.register 'postgresql', 'foreigner/connection_adapters/postgresql_adapter'
+Foreigner::Adapter.register 'jdbcpostgresql', 'foreigner/connection_adapters/postgresql_adapter'
+require 'foreigner/loader'
require 'foreigner/railtie' if defined?(Rails)
View
20 lib/foreigner/loader.rb
@@ -0,0 +1,20 @@
+module Foreigner
+ def self.load
+ ActiveRecord::ConnectionAdapters.module_eval do
+ include Foreigner::ConnectionAdapters::SchemaStatements
+ include Foreigner::ConnectionAdapters::SchemaDefinitions
+ end
+
+ ActiveRecord::SchemaDumper.class_eval do
+ include Foreigner::SchemaDumper
+ end
+
+ if defined?(ActiveRecord::Migration::CommandRecorder)
+ ActiveRecord::Migration::CommandRecorder.class_eval do
+ include Foreigner::Migration::CommandRecorder
+ end
+ end
+
+ Foreigner::Adapter.load!
+ end
+end
View
17 lib/foreigner/railtie.rb
@@ -2,22 +2,7 @@ module Foreigner
class Railtie < Rails::Railtie
initializer 'foreigner.load_adapter' do
ActiveSupport.on_load :active_record do
- ActiveRecord::ConnectionAdapters.module_eval do
- include Foreigner::ConnectionAdapters::SchemaStatements
- include Foreigner::ConnectionAdapters::SchemaDefinitions
- end
-
- ActiveRecord::SchemaDumper.class_eval do
- include Foreigner::SchemaDumper
- end
-
- if defined?(ActiveRecord::Migration::CommandRecorder)
- ActiveRecord::Migration::CommandRecorder.class_eval do
- include Foreigner::Migration::CommandRecorder
- end
- end
-
- Foreigner::Adapter.load!
+ Foreigner.load
end
end
end

0 comments on commit 53c6ca0

Please sign in to comment.
Something went wrong with that request. Please try again.