delay_henka 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 553f5923622e1bd283778df3469ef3842786e916
|
4
|
+
data.tar.gz: 88e2cc8dceca907f56c47b875db18cbd4c7854ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f1ce8f03834e7eecce350b8eed1baefa212ae2aab2834b6df5bdcc34b46478edd7a0b81edaed075e422486630152190c76ac3dd70a7e6f1b10eb6cb28de7fbf
|
7
|
+
data.tar.gz: 742b11afdb114d5ac7cf06569312225870df8ef0b1d66981ad2ce7ec1a6adf38ced54092a66c75929b911d31d8ecafeecea8901fbe59e260e7e39d32e6f380cb
|
@@ -11,18 +11,19 @@ module DelayHenka
|
|
11
11
|
belongs_to :changeable, polymorphic: true
|
12
12
|
|
13
13
|
validates :submitted_by_id, :attribute_name, presence: true
|
14
|
+
validates :schedule_at, presence: true
|
14
15
|
validates :state, inclusion: { in: STATES.values }
|
15
16
|
after_initialize :set_initial_state, if: :new_record?
|
16
17
|
|
17
18
|
scope :staged, -> { where(state: STATES[:STAGED]) }
|
18
19
|
|
19
|
-
def self.schedule(record:, changes:, by_id:)
|
20
|
+
def self.schedule(record:, changes:, by_id:, schedule_at: Time.current)
|
20
21
|
changes.each do |attribute, new_val|
|
21
22
|
old_val = record.public_send(attribute)
|
22
23
|
cleaned_new_val = cleanup_val(new_val)
|
23
24
|
record.public_send("#{attribute}=", cleaned_new_val)
|
24
25
|
next unless record.public_send("#{attribute}_changed?")
|
25
|
-
create!(changeable: record, submitted_by_id: by_id, attribute_name: attribute, old_value: old_val, new_value: cleaned_new_val)
|
26
|
+
create!(changeable: record, submitted_by_id: by_id, attribute_name: attribute, old_value: old_val, new_value: cleaned_new_val, schedule_at: schedule_at)
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
data/lib/delay_henka/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delay_henka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zino
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- app/workers/delay_henka/apply_changes_worker.rb
|
105
105
|
- config/routes.rb
|
106
106
|
- db/migrate/20181228205218_create_delay_henka_scheduled_changes.rb
|
107
|
+
- db/migrate/20190225140848_add_schedule_at.rb
|
107
108
|
- lib/delay_henka.rb
|
108
109
|
- lib/delay_henka/engine.rb
|
109
110
|
- lib/delay_henka/version.rb
|