diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb index 62a75d5..70c3d5d 100644 --- a/app/controllers/questions_controller.rb +++ b/app/controllers/questions_controller.rb @@ -1,11 +1,10 @@ class QuestionsController < ApplicationController def index - @question = Question.random + redirect_to Question.random end def show @question = Question.index(params[:index]) - render :index end end diff --git a/app/views/application/index.html.erb b/app/views/questions/show.html.erb similarity index 100% rename from app/views/application/index.html.erb rename to app/views/questions/show.html.erb diff --git a/config/routes.rb b/config/routes.rb index 24d2c26..10bce8e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do root 'questions#index' - get '/questions/:index', to: 'questions#show' + resources :questions end