質問編集履歴
1
history_form.rbにpresisted?を追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -202,9 +202,7 @@
|
|
202
202
|
|
203
203
|
end
|
204
204
|
|
205
|
-
|
206
|
-
|
207
|
-
|
205
|
+
|
208
206
|
|
209
207
|
def drop_down_list_block(name, label_text, choices, options = {})
|
210
208
|
|
@@ -351,3 +349,57 @@
|
|
351
349
|
|
352
350
|
|
353
351
|
どなたか教えていただけないでしょうか?宜しくお願いします。
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
追記
|
356
|
+
|
357
|
+
```ここに言語を入力
|
358
|
+
|
359
|
+
history_form.rb
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
class Admin::HistoryForm
|
364
|
+
|
365
|
+
include ActiveModel::Model
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
attr_accessor :history
|
370
|
+
|
371
|
+
delegate :presisted?, :save, to: :history
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
def initialize(history = nil)
|
376
|
+
|
377
|
+
@history = history
|
378
|
+
|
379
|
+
@history ||= History.new
|
380
|
+
|
381
|
+
end
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
def assign_attributes(params = {})
|
386
|
+
|
387
|
+
@params = params
|
388
|
+
|
389
|
+
history.assign_attributes(history_params)
|
390
|
+
|
391
|
+
end
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
private
|
396
|
+
|
397
|
+
def history_params
|
398
|
+
|
399
|
+
@params.require(:history).permit(:order, :undispatched)
|
400
|
+
|
401
|
+
end
|
402
|
+
|
403
|
+
end
|
404
|
+
|
405
|
+
```
|