[英]Calling controller's update on a custom form in rails 3
我有一個自定義的edit.html.erb表單,我想調用它來調用控制器的更新
這是我用於表單的代碼
<%= form_tag('/schedules/1', :class => "edit_schedule") do %>
我收到“沒有路線匹配” / schedules / 1”錯誤。
嘗試這個:
在控制器中編輯動作
def edit
@schedule = Schedule.find(1)
end
在視圖中edit.html.erb
<%= form_tag(@schedule, :class => "edit_schedule", :method => :put) do %>
在routes.rb中
resources :schedules
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.