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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.