开发者

Calling controller's update on a custom form in rails 3

I have a开发者_运维知识库 custom edit.html.erb form and I would like to it to call controller's update

This is the code I'm using for form

<%= form_tag('/schedules/1', :class => "edit_schedule") do %>

I'm getting "No route matches "/schedules/1" error.


Try this:

In controller edit action

def edit
  @schedule = Schedule.find(1)
end

In view edit.html.erb

<%= form_tag(@schedule, :class => "edit_schedule", :method => :put) do %>

In routes.rb

resources :schedules
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜