0
我建立爲大學工程一個導軌應用和我有問題未定義局部變量或方法`project_materials_new「爲#<ProjectsController:0x007f238ccb1ea0>
未定義局部變量或方法`project_materials_new」爲#
Extracted source(around line#18):
if @project.save
redirect_to project_materials_new
#redirect_to @project
else
render 'new'
Application Trace |框架跟蹤|全面跟蹤 應用程序/控制器/ projects_controller.rb:18:在'創造」
我想重定向到另一個控制器的路線......這是我(提取物)路由表...
Prefix Verb URI Pattern Controller#Action
project_materials_new GET /project_materials/new(.:format) project_materials#new
static_home GET /static/home(.:format) static#home
static_grid GET /static/grid(.:format) static#grid
static_project GET /static/project(.:format)
正如你所看到的,我有一個project_materials_new路由定義....爲什麼我不能重定向到它?
使用project_materials_new_path或project_materials_new_url – Bigxiang
謝謝,非常完美。 – amisam
@Bigxiang:請將評論移至回答,以便他人可以輕鬆找到答案。 –