matthuhiggins-foreigner 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -5,46 +5,12 @@ module Foreigner
|
|
5
5
|
|
6
6
|
module SchemaDefinitions
|
7
7
|
def self.included(base)
|
8
|
-
base::TableDefinition.class_eval do
|
9
|
-
include Foreigner::ConnectionAdapters::TableDefinition
|
10
|
-
end
|
11
|
-
|
12
8
|
base::Table.class_eval do
|
13
9
|
include Foreigner::ConnectionAdapters::Table
|
14
10
|
end
|
15
11
|
end
|
16
12
|
end
|
17
13
|
|
18
|
-
module TableDefinition
|
19
|
-
def self.included(base)
|
20
|
-
base.class_eval do
|
21
|
-
include InstanceMethods
|
22
|
-
alias_method_chain :references, :foreign_keys
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
module InstanceMethods
|
27
|
-
def references_with_foreign_keys(*args)
|
28
|
-
options = args.extract_options!
|
29
|
-
if options[:foreign_key].present?
|
30
|
-
ActiveSupport::Deprecation.warn(
|
31
|
-
':foreign_key option is deprecated inside create_table. ' +
|
32
|
-
'to add a foreign key, use add_foreign_key', caller[0,10]
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
references_without_foreign_keys(*(args << options))
|
37
|
-
end
|
38
|
-
|
39
|
-
def foreign_key(to_table, options = {})
|
40
|
-
ActiveSupport::Deprecation.warn(
|
41
|
-
'adding a foreign key inside create_table is deprecated. ' +
|
42
|
-
'to add a foreign key, use add_foreign_key', caller[0,10]
|
43
|
-
)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
14
|
module Table
|
49
15
|
def self.included(base)
|
50
16
|
base.class_eval do
|
@@ -83,7 +49,7 @@ module Foreigner
|
|
83
49
|
@base.remove_foreign_key(@table_name, options)
|
84
50
|
end
|
85
51
|
|
86
|
-
# Adds a :foreign_key option to
|
52
|
+
# Adds a :foreign_key option to Table.references.
|
87
53
|
# If :foreign_key is true, a foreign key constraint is added to the table.
|
88
54
|
# You can also specify a hash, which is passed as foreign key options.
|
89
55
|
#
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matthuhiggins-foreigner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 63
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
8
|
+
- 1
|
9
|
+
version: 0.8.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Matthew Higgins
|
@@ -54,7 +53,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
53
|
requirements:
|
55
54
|
- - ">="
|
56
55
|
- !ruby/object:Gem::Version
|
57
|
-
hash: 59
|
58
56
|
segments:
|
59
57
|
- 1
|
60
58
|
- 8
|
@@ -65,7 +63,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
63
|
requirements:
|
66
64
|
- - ">="
|
67
65
|
- !ruby/object:Gem::Version
|
68
|
-
hash: 17
|
69
66
|
segments:
|
70
67
|
- 1
|
71
68
|
- 3
|