Question

In my rails app, I have a student model, and a material_student. Just after the student login, I would redirect it on a page that give him the choice to select between two "edit" views. First is provided by student_controller to manage is personal data and other one is provided by material_student_controller to select some material.

I'm unable to find :

1) the correct route in routes.rb

routes.rb

resources :students do

  get 'dashboard' => 'dashboard#index'

end

2) the correct "redirect_to" in session_controller to call the dashboard

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

The choice page is called "dashboard" and is provided by a dashboard_controller

class DashboardController < ApplicationController

  def index

  end

end

Could you help me ?

Many thanks in advance

Nicolas

Was it helpful?

Solution

In routes.rb

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

In action

redirect_to dashboard_path
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top