0
我在視圖中有以下代碼,用於編輯規範狀態(完成或未完成)。從參數中嵌套散列檢索選項
%table
= form_for project_specification_path(@project,@specification), :method => :put do |f|
%tr
%td
= f.label :status, 'Status'
= f.select :status, ['Completed','Not completed']
%tr
%td
= f.submit 'Save'
點擊「保存」後,在規格控制器的更新方法中,我需要更新@specification屬性。
PARAMS如下:
=> {"utf8"=>"✓",
"_method"=>"put",
"authenticity_token"=>"Wp2OSBaOCP9aIx27B0ZTnvuFtN0m4O45efDwdA5KB5Q=",
"/projects/1/specifications/1"=>{"status"=>"Completed"},
"Status"=>"Save status",
"action"=>"update",
"controller"=>"specifications",
"project_id"=>"1",
"id"=>"1"}
我需要寫類似@ specification.update_attributes(????),但我不知道如何檢索參數:狀態從嵌套的哈希值。
感謝