From faab77cebb9273ba7cd1234e233e0f53f9b5dc33 Mon Sep 17 00:00:00 2001 From: Jack Danger Canty Date: Mon, 5 Oct 2015 14:21:52 -0700 Subject: [PATCH] Redirect to permalinks --- app/controllers/questions_controller.rb | 3 +-- .../{application/index.html.erb => questions/show.html.erb} | 0 config/routes.rb | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) rename app/views/{application/index.html.erb => questions/show.html.erb} (100%) 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