Я знаю, что этот вопрос задан раньше и обычно он связан с методом обновления в контроллере. Я уже прошел через это, и, похоже, не моя проблема. Я думаю, что мой относится к файлу представления и строке с тегом submit. Я пробовал несколько вещей, но все просто дает мне ошибки о неправильном количестве аргументов. Любые предложения были бы замечательными!Неопределенный метод stringify keys
Вид:
= form_for [:admin, @diagnostic], url: admin_diagnostic_path(@diagnostic), html: {method: :put} do |f|
.field
= label_tag :notes
= f.text_field "notes"
= submit_tag t('.Save'), @diagnostic.data["Save"]
.field
= link_to 'show', admin_diagnostics_path
Контроллер:
def update
@diagnostic = DiagnosticInfo.find(params[:id])
if @diagnostic.update_attributes(params[:diagnostic_info])
redirect_to admin_diagnostic_path, notice: 'Successfully updated.'
else
render action: "edit"
end
end
Тест:
it "updates a diagnostic report" do
diagnostic_info = FG.create(:diagnostic_info)
diagnostic_info.save!
visit edit_admin_diagnostic_path(diagnostic_info)
fill_in 'diagnostic_info_notes', with: "test notes"
click_button "Save"
page.should have_content("Saved")
page.should have_content("test notes")
end