我正在为一个大学项目创建一个rails应用程序,而且我遇到了问题。
未定义局部变量或方法`project_materials_new‘用于#
提取源(第18行前后):
if @project.save
redirect_to project_materials_new
#redirect_to @project
else
render 'new'应用程序跟踪框架跟踪全跟踪应用程序/控制器/项目_控制员.18:18:in‘`create’
我想重定向到另一个控制器路线..。这是我的(摘录)路线图..。
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路由.为什么我不能重来一遍?
发布于 2013-08-27 04:51:44
project_materials_new只是一个前缀,使用project_materials_new_path或project_materials_new_url代替它。
详见Rails文档:http://api.rubyonrails.org/classes/ActionDispatch/Routing.html
https://stackoverflow.com/questions/18456887
复制相似问题