2

在我的 rails 应用程序中,我有一个学生模型和一个 material_student。就在学生登录后,我会将其重定向到一个页面上,让他可以选择在两个“编辑”视图之间进行选择。首先是student_controller 提供来管理个人数据,另一个是material_student_controller 提供来选择一些材料。

我找不到:

1) routes.rb 中正确的路由

路线.rb

resources :students do

  get 'dashboard' => 'dashboard#index'

end

2) session_controller 中正确的“redirect_to”调用仪表板

session_controller.rb

class SessionsController < ApplicationController

  def create
    login from omniauth blahblahblah
    redirect_to :controller => 'dashboard', :action => 'index', :id => user.as_user_id
  end
end

选择页面称为“仪表板”,由仪表板控制器提供

class DashboardController < ApplicationController

  def index

  end

end

你可以帮帮我吗 ?

提前谢谢了

尼古拉斯

4

1 回答 1

3

在路线.rb

resources :students
resources :dashboard, :only => [:index]

在行动

redirect_to dashboard_path
于 2013-11-16T20:36:16.363 回答