matthuhiggins-foreigner 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,8 +46,16 @@ end
|
|
|
46
46
|
|
|
47
47
|
module ActiveRecord
|
|
48
48
|
module ConnectionAdapters
|
|
49
|
-
MysqlAdapter
|
|
50
|
-
|
|
49
|
+
if defined? MysqlAdapter
|
|
50
|
+
MysqlAdapter.class_eval do
|
|
51
|
+
include Foreigner::ConnectionAdapters::MysqlAdapter
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if defined? JdbcAdapter
|
|
56
|
+
JdbcAdapter.class_eval do
|
|
57
|
+
include Foreigner::ConnectionAdapters::MysqlAdapter
|
|
58
|
+
end
|
|
51
59
|
end
|
|
52
60
|
end
|
|
53
61
|
end
|
|
@@ -49,8 +49,16 @@ end
|
|
|
49
49
|
|
|
50
50
|
module ActiveRecord
|
|
51
51
|
module ConnectionAdapters
|
|
52
|
-
PostgreSQLAdapter
|
|
53
|
-
|
|
52
|
+
if defined? PostgreSQLAdapter
|
|
53
|
+
PostgreSQLAdapter.class_eval do
|
|
54
|
+
include Foreigner::ConnectionAdapters::PostgreSQLAdapter
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
if defined? JdbcAdapter
|
|
59
|
+
JdbcAdapter.class_eval do
|
|
60
|
+
include Foreigner::ConnectionAdapters::PostgreSQLAdapter
|
|
61
|
+
end
|
|
54
62
|
end
|
|
55
63
|
end
|
|
56
64
|
end
|
|
@@ -16,8 +16,7 @@ module Foreigner
|
|
|
16
16
|
"ADD CONSTRAINT #{quote_column_name(foreign_key_name)} " +
|
|
17
17
|
"FOREIGN KEY (#{quote_column_name(column)}) " +
|
|
18
18
|
"REFERENCES #{quote_table_name(ActiveRecord::Migrator.proper_table_name(to_table))}(#{primary_key})"
|
|
19
|
-
|
|
20
|
-
sql << " #{dependency}" unless dependency.blank?
|
|
19
|
+
sql << " #{dependency}" if dependency.present?
|
|
21
20
|
|
|
22
21
|
execute(sql)
|
|
23
22
|
end
|
data/lib/foreigner.rb
CHANGED
|
@@ -23,7 +23,7 @@ module Foreigner
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def on_load(&block)
|
|
26
|
-
if Rails.version >= '3.0'
|
|
26
|
+
if defined?(Rails) && Rails.version >= '3.0'
|
|
27
27
|
ActiveSupport.on_load :active_record do
|
|
28
28
|
unless ActiveRecord::Base.connected?
|
|
29
29
|
ActiveRecord::Base.configurations = Rails.application.config.database_configuration
|
metadata
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: matthuhiggins-foreigner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
+
hash: 7
|
|
4
5
|
prerelease: false
|
|
5
6
|
segments:
|
|
6
7
|
- 0
|
|
7
|
-
-
|
|
8
|
+
- 6
|
|
8
9
|
- 0
|
|
9
|
-
version: 0.
|
|
10
|
+
version: 0.6.0
|
|
10
11
|
platform: ruby
|
|
11
12
|
authors:
|
|
12
13
|
- Matthew Higgins
|
|
@@ -14,7 +15,7 @@ autorequire:
|
|
|
14
15
|
bindir: bin
|
|
15
16
|
cert_chain: []
|
|
16
17
|
|
|
17
|
-
date: 2010-
|
|
18
|
+
date: 2010-05-22 00:00:00 -07:00
|
|
18
19
|
default_executable:
|
|
19
20
|
dependencies: []
|
|
20
21
|
|
|
@@ -49,18 +50,22 @@ rdoc_options: []
|
|
|
49
50
|
require_paths:
|
|
50
51
|
- lib
|
|
51
52
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
|
+
none: false
|
|
52
54
|
requirements:
|
|
53
55
|
- - ">="
|
|
54
56
|
- !ruby/object:Gem::Version
|
|
57
|
+
hash: 59
|
|
55
58
|
segments:
|
|
56
59
|
- 1
|
|
57
60
|
- 8
|
|
58
61
|
- 6
|
|
59
62
|
version: 1.8.6
|
|
60
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
|
+
none: false
|
|
61
65
|
requirements:
|
|
62
66
|
- - ">="
|
|
63
67
|
- !ruby/object:Gem::Version
|
|
68
|
+
hash: 23
|
|
64
69
|
segments:
|
|
65
70
|
- 1
|
|
66
71
|
- 3
|
|
@@ -69,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
74
|
requirements: []
|
|
70
75
|
|
|
71
76
|
rubyforge_project: matthuhiggins-foreigner
|
|
72
|
-
rubygems_version: 1.3.
|
|
77
|
+
rubygems_version: 1.3.7
|
|
73
78
|
signing_key:
|
|
74
79
|
specification_version: 3
|
|
75
80
|
summary: Foreign keys for Rails
|