active_form_objects 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dsl/savings.rb +8 -0
- data/lib/handlers/savings.rb +0 -5
- 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: 3c1b13583aed6b595d8dded34bbab6c0eb0453880b1689b36f6c83b2c42864fd
|
4
|
+
data.tar.gz: 173f5611e40785b68f19f3b0969b34a40580110b7dfac3d8a83a7c959c4b2b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c222d8eea18ff97532ef450482f1ed7411e33fec22910a2fc4b1223d2081b296eec2dfb085fbdf90181bc60e54a96bb70eb41f30d5d38b81a62e1fc03fd7a872
|
7
|
+
data.tar.gz: 3b50cf192e75592de311794b73af4ec7102ed32d6f68df27410dd14ee797f56ebb747e94a52737d121371d7653a1fbaee8c933a15a2a3f5dad4ca7d5f00aa272
|
data/lib/dsl/savings.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'active_support'
|
2
2
|
require 'active_record'
|
3
|
+
|
3
4
|
require_relative '../handlers/savings'
|
5
|
+
require_relative '../handlers/hooks'
|
4
6
|
|
5
7
|
module Dsl
|
6
8
|
module Savings
|
@@ -18,6 +20,12 @@ module Dsl
|
|
18
20
|
Handlers::Savings.new(self).save!
|
19
21
|
end
|
20
22
|
|
23
|
+
def validate!
|
24
|
+
Handlers::BeforeSaveHooks.handle(self)
|
25
|
+
super
|
26
|
+
@params
|
27
|
+
end
|
28
|
+
|
21
29
|
def save
|
22
30
|
save!
|
23
31
|
rescue
|
data/lib/handlers/savings.rb
CHANGED
@@ -10,7 +10,6 @@ module Handlers
|
|
10
10
|
class Savings < Base
|
11
11
|
def save!(&block)
|
12
12
|
ActiveRecord::Base.transaction do
|
13
|
-
before_save_hooks!
|
14
13
|
@klass.validate!
|
15
14
|
after_validations_hooks!
|
16
15
|
block ? save_with_block!(block) : save_without_block!
|
@@ -22,10 +21,6 @@ module Handlers
|
|
22
21
|
raise ActiveRecord::RecordInvalid.new(e.record)
|
23
22
|
end
|
24
23
|
|
25
|
-
def before_save_hooks!
|
26
|
-
BeforeSaveHooks.handle(@klass)
|
27
|
-
end
|
28
|
-
|
29
24
|
def after_save_hooks!
|
30
25
|
Delegates.handle(@klass)
|
31
26
|
AfterSaveHooks.handle(@klass)
|