morse_active_record_helpers 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/morse_active_record_helpers.rb +9 -8
- data/lib/morse_active_record_helpers/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: 06ddf469c0c0ef6aaa959eca6a21500ef3f39524
|
4
|
+
data.tar.gz: a585a5a41ef62ffb9b14f3ea5e6f9330f0897238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c6f0900f5a80adf0a40835231e21ff4c242fd45e446ae871a181d4ff61ddf1396517a7a2bdc79ef58b4247639812e19277430222316e3106d1594fca3506aa4
|
7
|
+
data.tar.gz: d7f57909d7c1672daca776a06d6c7b6e01d7250f42fff0bf93b3b7abce676aa6ac9577f70bc6de64fef8d0560ad44ff0335df58e3593b082a13507d75b7b139f
|
@@ -15,6 +15,15 @@ module MorseActiveRecordHelpers
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
def correct_chronological_order(start, finish)
|
19
|
+
if self.send(start) && self.send(finish)
|
20
|
+
if self.send(start) > self.send(finish)
|
21
|
+
errors.add(:base,"#{finish.to_s.humanize} can not be before #{start.to_s.humanize}")
|
22
|
+
return false
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
18
27
|
def blank_to_nil(thing)
|
19
28
|
if self.send(thing).blank?
|
20
29
|
self.send(thing.to_s+'=',nil)
|
@@ -51,14 +60,6 @@ module MorseActiveRecordHelpers
|
|
51
60
|
end
|
52
61
|
end
|
53
62
|
|
54
|
-
def correct_chronological_order(start, finish)
|
55
|
-
if self.send(start) && self.send(finish)
|
56
|
-
if self.send(start) > self.send(finish)
|
57
|
-
errors.add(:base,"#{finish} can not be before #{start}")
|
58
|
-
return false
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
63
|
|
63
64
|
def there_can_be_only_one(thing)
|
64
65
|
if new_record?
|