This repository was archived by the owner on Jul 24, 2020. It is now read-only.
Commit 78ef7bf 1 parent 57b5263 commit 78ef7bf Copy full SHA for 78ef7bf
File tree 2 files changed +14
-12
lines changed
2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -193,15 +193,4 @@ def markdown_help
193
193
end
194
194
end
195
195
196
- # function to check for deleted checkin/checkout procedures and hard-delete them after equipment model update
197
- def delete_procedures ( params , phase )
198
- # phase needs to be equal to either "checkout" or "checkin"
199
- phase_params = params [ :equipment_model ] [ :"#{ phase } _procedures_attributes" ]
200
- phase_params . each do |k , v |
201
- if v [ "id" ] and v [ "_destroy" ] != "false"
202
- @equipment_model . send ( :"#{ phase } _procedures" ) [ k . to_i ] . destroy ( :force )
203
- end
204
- end
205
- end
206
-
207
196
end
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def delete_files
65
65
66
66
def update
67
67
delete_files
68
-
68
+
69
69
if @equipment_model . update_attributes ( params [ :equipment_model ] )
70
70
# hard-delete any deleted checkin/checkout procedures
71
71
delete_procedures ( params , "checkout" )
@@ -82,4 +82,17 @@ def destroy
82
82
flash [ :notice ] = "Successfully destroyed equipment model."
83
83
redirect_to equipment_models_url
84
84
end
85
+
86
+ private
87
+
88
+ # function to check for deleted checkin/checkout procedures and hard-delete them after equipment model update
89
+ def delete_procedures ( params , phase )
90
+ # phase needs to be equal to either "checkout" or "checkin"
91
+ phase_params = params [ :equipment_model ] [ :"#{ phase } _procedures_attributes" ]
92
+ phase_params . each do |k , v |
93
+ if v [ "id" ] and v [ "_destroy" ] != "false"
94
+ @equipment_model . send ( :"#{ phase } _procedures" ) [ k . to_i ] . destroy ( :force )
95
+ end
96
+ end
97
+ end
85
98
end
You can’t perform that action at this time.
0 commit comments