Can't figure out this routing problem: I redirect from my update controller action to the modified @timecard, and get the following error: No route matches [PATCH] "/timecards"
Why does rails try to redirect using PATCH and to timecards#index?
Is that not how I redirect to the recently edited @timecard?
In timecards_controller.rb:
def edit
@timecard = Timecard.find(params[:id])
end
def update
@timecard = Timecard.find(params[:id])
@timecard.update_attributes!(timecard_params)
redirect_to @timecard
end
Output of rake routes:
$ rake routes
Prefix Verb URI Pattern Controller#Action
timecard_timecard_entries GET /timecards/:timecard_id/timecard_entries(.:format) timecard_entries#index
POST /timecards/:timecard_id/timecard_entries(.:format) timecard_entries#create
new_timecard_timecard_entry GET /timecards/:timecard_id/timecard_entries/new(.:format) timecard_entries#new
edit_timecard_timecard_entry GET /timecards/:timecard_id/timecard_entries/:id/edit(.:format) timecard_entries#edit
timecard_timecard_entry GET /timecards/:timecard_id/timecard_entries/:id(.:format) timecard_entries#show
PATCH /timecards/:timecard_id/timecard_entries/:id(.:format) timecard_entries#update
PUT /timecards/:timecard_id/timecard_entries/:id(.:format) timecard_entries#update
DELETE /timecards/:timecard_id/timecard_entries/:id(.:format) timecard_entries#destroy
timecards GET /timecards(.:format) timecards#index
POST /timecards(.:format) timecards#create
new_timecard GET /timecards/new(.:format) timecards#new
edit_timecard GET /timecards/:id/edit(.:format) timecards#edit
timecard GET /timecards/:id(.:format) timecards#show
PATCH /timecards/:id(.:format) timecards#update
PUT /timecards/:id(.:format) timecards#update
DELETE /timecards/:id(.:format) timecards#destroy
root GET / timecards#index