foreigner 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b450dcadd1e5c2ea9a317d290889057748b97d24
|
4
|
+
data.tar.gz: 576ad25ce8af650e1bc7277eb533f68219341bc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e31834038d39f1bc66234f0d7893889802c5793624e74d2b0dd076aa1e2fb2d2fbfbe968f4a0a94defd71616b75e90331ee9ccc3a53cb7df77f8b9c4758575a9
|
7
|
+
data.tar.gz: e1b7c552f65517cafa9ec2e2864dae07be605d4c6295f62964459f52b03ed34769fbe1820e4717cc42f2e46ba5969a68923d8bf60b578cccc6e19fd5a84e71d6
|
data/lib/foreigner/adapter.rb
CHANGED
@@ -20,6 +20,15 @@ module Foreigner
|
|
20
20
|
def configured_name
|
21
21
|
@configured_name ||= ActiveRecord::Base.connection_pool.spec.config[:adapter]
|
22
22
|
end
|
23
|
+
|
24
|
+
def safe_include(adapter_class_name, foreigner_module)
|
25
|
+
ActiveRecord::ConnectionAdapters.const_get(adapter_class_name).class_eval do
|
26
|
+
unless ancestors.include? foreigner_module
|
27
|
+
include foreigner_module
|
28
|
+
end
|
29
|
+
end
|
30
|
+
rescue
|
31
|
+
end
|
23
32
|
end
|
24
33
|
end
|
25
34
|
end
|
@@ -32,12 +32,12 @@ module Foreigner
|
|
32
32
|
# foreign_key_exists?(:suppliers, :companies)
|
33
33
|
#
|
34
34
|
# # Check a foreign key with a custom name exists
|
35
|
-
# foreign_key_exists?(:suppliers, name: "fk_company_id"
|
35
|
+
# foreign_key_exists?(:suppliers, name: "fk_company_id")
|
36
36
|
#
|
37
37
|
# # Check a foreign key on a column
|
38
|
-
# foreign_key_exists?(:suppliers, column: "company_id"
|
38
|
+
# foreign_key_exists?(:suppliers, column: "company_id")
|
39
39
|
#
|
40
|
-
def foreign_key_exists?(table_name,
|
40
|
+
def foreign_key_exists?(table_name, options)
|
41
41
|
end
|
42
42
|
|
43
43
|
# Adds a new foreign key to the +from_table+, referencing the primary key of +to_table+
|
@@ -40,11 +40,5 @@ module Foreigner
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
ActiveRecord::ConnectionAdapters.const_get(adapter).class_eval do
|
46
|
-
include Foreigner::ConnectionAdapters::Mysql2Adapter
|
47
|
-
end
|
48
|
-
rescue
|
49
|
-
end
|
50
|
-
end
|
43
|
+
Foreigner::Adapter.safe_include :JdbcAdapter, Foreigner::ConnectionAdapters::Mysql2Adapter
|
44
|
+
Foreigner::Adapter.safe_include :Mysql2Adapter, Foreigner::ConnectionAdapters::Mysql2Adapter
|
@@ -34,11 +34,5 @@ module Foreigner
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
ActiveRecord::ConnectionAdapters.const_get(adapter).class_eval do
|
40
|
-
include Foreigner::ConnectionAdapters::PostgreSQLAdapter
|
41
|
-
end
|
42
|
-
rescue
|
43
|
-
end
|
44
|
-
end
|
37
|
+
Foreigner::Adapter.safe_include :JdbcAdapter, Foreigner::ConnectionAdapters::PostgreSQLAdapter
|
38
|
+
Foreigner::Adapter.safe_include :PostgreSQLAdapter, Foreigner::ConnectionAdapters::PostgreSQLAdapter
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreigner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Higgins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: 1.3.5
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project: foreigner
|
95
|
-
rubygems_version: 2.0.
|
95
|
+
rubygems_version: 2.0.3
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Foreign Keys for Rails
|