acts_as_living 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acts_as_living/acts_as_living.rb +1 -1
- data/lib/acts_as_living/validations_definer.rb +19 -25
- data/lib/acts_as_living/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: 8980c57bb91eee242c77df0474a818135fb99903e23d540aed8f0e5daa666e4c
|
4
|
+
data.tar.gz: 34cfee00e11742cde4d7a49c68e22f9282ba58d7f701df218e05cde8e6646b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777d163e2a0e02ba0d479a4ecfa571dfe35347ab6abd65afd14400a53e0ba3555e4b50b37d7866fd256782de75d1190e5cd7fcbbfdd77f279709e34fbde0dec2
|
7
|
+
data.tar.gz: 5d0134a2b6c6cb0d41b691c2ffde08f9e816619eaebaf669cbfb4decca17fe6dba988181a14fa1cdf8671cc35a8b1d003eef87f9068eee53624e3380d55e8700
|
@@ -20,7 +20,7 @@ module ActsAsLiving::ActsAsLiving
|
|
20
20
|
ActsAsLiving::MethodsDefiner.call(self)
|
21
21
|
ActsAsLiving::EnumDefiner.call(self)
|
22
22
|
ActsAsLiving::ScopesDefiner.call(self)
|
23
|
-
ActsAsLiving::ValidationsDefiner.call(self)
|
23
|
+
# ActsAsLiving::ValidationsDefiner.call(self)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -1,32 +1,26 @@
|
|
1
1
|
module ActsAsLiving::ValidationsDefiner
|
2
|
-
def self.call(klass)
|
3
|
-
|
4
|
-
|
2
|
+
# def self.call(klass)
|
3
|
+
# klass.class_eval do
|
4
|
+
# include InstanceMethods
|
5
5
|
|
6
|
-
|
6
|
+
# validates :stage, presence: true
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
8
|
+
# validate :stage_progression, on: :update, if: :stage_changed?
|
9
|
+
# validate :stage_is_first_stage, on: :create, if: :stage_changed?
|
10
|
+
# end
|
11
|
+
# end
|
12
12
|
|
13
|
-
module InstanceMethods
|
14
|
-
|
15
|
-
|
13
|
+
# module InstanceMethods
|
14
|
+
# def stage_progression
|
15
|
+
# return if stage.to_s == self.class.death.to_s || stage == stage_after(stage_was)
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
# message = if stage_was == self.class.final_stage
|
18
|
+
# "The contract can only be updated to '#{self.class.death}'"
|
19
|
+
# else
|
20
|
+
# "The contract can only be updated to '#{self.class.death}' or '#{stage_after(stage_was)}'"
|
21
|
+
# end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
def stage_is_first_stage
|
27
|
-
return if first_stage?
|
28
|
-
|
29
|
-
errors.add(:stage, "Contract has to be initialized with '#{first_stage}' stage")
|
30
|
-
end
|
31
|
-
end
|
23
|
+
# errors.add(:stage, message)
|
24
|
+
# end
|
25
|
+
# end
|
32
26
|
end
|