zero_downtime 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zero_downtime/deprecatable.rb +11 -5
- data/lib/zero_downtime/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dde9799f65bdb23430fba12c384b392873ecd1d9
|
4
|
+
data.tar.gz: def035b42a3e906094425200fcbf57b602c0cb84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ede37af28786dd85336373e874c029c8a152dffc013bc1e465cbe6e885af7ebcee264395cbf357c9724b6f77ff50e62e98c105dfb38cfb2a9b514e4c03f295f3
|
7
|
+
data.tar.gz: b30e3ade26a386461f540965b30ae69da19c73d8fc8a8f2539329f3c7332ddbd925ea94d05846074e4f21ac95e902e4d4f17a6cfbe6a48105f12ec72c6fcf6d9
|
@@ -26,8 +26,8 @@ module ZeroDowntime
|
|
26
26
|
# deprecate a given column
|
27
27
|
# so it will be ignore by activerecord
|
28
28
|
# we can remove it once the deprecation is deployed
|
29
|
-
def deprecate_column(column_name)
|
30
|
-
deprecate_column_reader(column_name)
|
29
|
+
def deprecate_column(column_name, options={})
|
30
|
+
deprecate_column_reader(column_name, options)
|
31
31
|
deprecate_column_writer(column_name)
|
32
32
|
override_attribute_methods
|
33
33
|
|
@@ -61,9 +61,15 @@ module ZeroDowntime
|
|
61
61
|
@attribute_methods_overriden = true
|
62
62
|
end
|
63
63
|
|
64
|
-
def deprecate_column_reader(column_name)
|
65
|
-
|
66
|
-
|
64
|
+
def deprecate_column_reader(column_name, options)
|
65
|
+
if options[:nil]
|
66
|
+
define_method(column_name) do
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
else
|
70
|
+
define_method(column_name) do
|
71
|
+
fail DeprecatedColumn, "attempted to read #{column_name}"
|
72
|
+
end
|
67
73
|
end
|
68
74
|
end
|
69
75
|
|