在視頻控制器的更新動作,我已經寫 - >第一個參數不能包含零或爲空上呈現
def update
if current_user.video.update_attributes(video_params)
flash[:success] = "Video App Updated!"
redirect_to root_url
else
render :edit
end
end
然而,渲染:編輯部分似乎被扔出來的錯誤。它說:
First argument in form cannot contain nil or be empty
Extracted source (around line #6):
<div class="row">
<div class="span6 offset3">
<%= form_for(@video) do |f| %> # line 6
我假設我不完全理解渲染正在做什麼。這是我編輯動作的樣子 - >
def edit
@video = current_user.video
end
你們認爲什麼?仍然是小白,非常感謝:)
解釋我想你是不是在「@video」變量 – Jeet
嘿米希爾得到任何價值。雖然這是奇怪的部分。如果我只是加載編輯視圖,一切正常。但是,一旦我更新並通過渲染,它就不再給@video任何值。 –