를 작동하지 : 새와 컨트롤러 : 뉴스루비 업데이트 작업 내가 가지고있는 하나 개의 모델을
뉴스 컨트롤러 방법 : 여기
def edit
@new = New.find(params[:id].to_i)
end
def update
@new = New.find(params[:id].to_i)
@new.update_attributes(params[:new])
flash[:notice] = "Sikeresen frissítve"
redirect_to news_path
rescue ActiveRecord::RecordInvalid
flash[:error] = "Valami hiba lépett fel"
redirect_to edit_news_path(@new)
end
그리고 것은 edit.html.erb
<%= error_messages_for :news %>
<% form_for :new, :url=>news_path(@new), :html=>{:method=>:put} do |m|%>
<p> <%= m.label(:title,"title: ") %>
<%= m.text_field(:title) %></p>
<p>
<%= m.label(:text, "text: ") %>
<%= m.text_area(:text) %>
</p>
<%= submit_tag "Save" %>
<% end %>
에게 있습니다
괜찮아요, 오류, 필드가 텍스트 상자에 나타났습니다. 그러나 제출 버튼을 클릭하면 알 수없는 동작 오류가 발생했습니다.
OP가 그의 컨트롤러 이름으로 뉴스를 고수하고자한다면 그는 "뉴스"를 계산할 수 없도록 굴절 장치를 변경할 수 있습니다 –