I've got a model "Job" which i'm adding a new action "preview" to. In order to support this new action, i've modifed routes.rb as follows:
resources :jobs do
member do
get 'preview'
end
end
Then on my Job create action i've got the following:
if @job.save
redirect_to preview_job_url
However, when I save the form, instead of redirecting to the preview url, I get the following routing error:
Routing Error
No route matches {:action=>"preview", :controller=>"jobs"}
Can't figure out why this is happening, as the URL works properly (http://localhost:3000/jobs/id/preview) and if I run rake routes the proper route seems to be there:
preview_jobs GET /jobs/preview(.:format) {:action=>"preview", :controller=>"jobs"}
Any ideas as to what could be happening? It seems like all the pieces are in place, but I'm new to Rails so i'm sure i'm missing something obvious. Many thanks.