anonymous_active_record 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/anonymous_active_record.rb +15 -7
- data/lib/anonymous_active_record/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0c82662e8af866d1743315b3a68a9b76fc6658b2a22ed48642b307c204ad067
|
4
|
+
data.tar.gz: 74a221bcf95cb888be5729aef71838919835fb2b20bef8caa0338ab619484542
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6737111961bdc7ec78a05bf51cc7c16f7a6f08569a3f96d4f64bc993f9b80cdf1f57c84fa4736ed06b750b92e9b97176ae12a4800dd287d6b19013a1ec0505f1
|
7
|
+
data.tar.gz: 2cb6992f6a210d06d13e5fd4c4a8dacd79a8c3e38b5c1dff04ccb014f3b9c2c07375217417ad743df8c0b65f5cb0f6a888ee65c900d3a3cf9ed8457a8029f832
|
@@ -53,18 +53,26 @@ module AnonymousActiveRecord
|
|
53
53
|
# :name and :type are required at minimum
|
54
54
|
name = col.delete(:name)
|
55
55
|
type = col.delete(:type)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
t.column(name, type, **col)
|
60
|
-
end
|
56
|
+
t.column(name, type, col)
|
57
|
+
elsif col.is_a?(Array)
|
58
|
+
t.column col[0], col[-1] || :string
|
61
59
|
else
|
62
60
|
t.column col, :string
|
63
61
|
end
|
64
62
|
end
|
65
63
|
indexes.each do |idx_options|
|
66
|
-
|
67
|
-
|
64
|
+
if idx_options.is_a?(Hash)
|
65
|
+
column_names = idx_options.delete(:columns)
|
66
|
+
t.index column_names, idx_options
|
67
|
+
elsif idx_options.is_a?(Array)
|
68
|
+
if idx_options.length == 1
|
69
|
+
t.index idx_options[0]
|
70
|
+
else
|
71
|
+
t.index idx_options[0], idx_options[-1]
|
72
|
+
end
|
73
|
+
else
|
74
|
+
t.index idx_options
|
75
|
+
end
|
68
76
|
end
|
69
77
|
t.timestamps if timestamps
|
70
78
|
end
|