在我的rails应用程序中,我有一个学生模型和一个material_student。在学生登录后,我会将其重定向到一个页面,让他可以选择在两个“编辑”视图之间进行选择。第一个是student_controller提供来管理个人数据,另一个是由material_student_controller提供来选择一些材料。
我找不到:
1)routes.rb
中的正确路线的routes.rb
resources :students do
get 'dashboard' => 'dashboard#index'
end
2)session_controller中正确的“redirect_to”来调用仪表板
sessions_controller.rb
class SessionsController < ApplicationController
def create
login from omniauth blahblahblah
redirect_to :controller => 'dashboard', :action => 'index', :id => user.as_user_id
end
end
选择页面称为“仪表板”,由dashboard_controller提供
class DashboardController < ApplicationController
def index
end
end
你能帮帮我吗?
非常感谢提前
尼古拉斯
答案 0 :(得分:3)
在routes.rb
中resources :students
resources :dashboard, :only => [:index]
行动中
redirect_to dashboard_path