File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -9,23 +9,24 @@ class IssueSupplyItem < ActiveRecord::Base
9
9
includes ( :supply_item ) . order ( "#{ SupplyItem . table_name } .name ASC" )
10
10
}
11
11
12
- after_destroy -> ( isi ) {
13
- RedmineSupply ::RecordIssueSupplyItemChange . ( isi . issue ,
14
- isi . supply_item ,
15
- isi . quantity )
12
+ after_destroy -> {
13
+ RedmineSupply ::RecordIssueSupplyItemChange . ( issue ,
14
+ supply_item ,
15
+ quantity )
16
16
}
17
17
18
- after_create -> ( isi ) {
19
- RedmineSupply ::RecordIssueSupplyItemChange . ( isi . issue ,
20
- isi . supply_item ,
21
- -1 * isi . quantity )
18
+ after_create -> {
19
+ RedmineSupply ::RecordIssueSupplyItemChange . ( issue ,
20
+ supply_item ,
21
+ -1 * quantity )
22
22
}
23
23
24
- after_update -> ( isi ) {
25
- if isi . quantity_was != isi . quantity
26
- RedmineSupply ::RecordIssueSupplyItemChange . ( isi . issue ,
27
- isi . supply_item ,
28
- isi . quantity_was - isi . quantity )
24
+ after_update -> {
25
+ if changes = saved_changes [ 'quantity' ]
26
+ quantity_was , quantity = changes
27
+ RedmineSupply ::RecordIssueSupplyItemChange . ( issue ,
28
+ supply_item ,
29
+ quantity_was - quantity )
29
30
end
30
31
}
31
32
You can’t perform that action at this time.
0 commit comments