From dc60251ab49511cfdb9498f88dbe533bd2b5e254 Mon Sep 17 00:00:00 2001 From: jomo Date: Tue, 27 Jan 2015 22:54:47 +0100 Subject: [PATCH] actually correct order of prev/next info --- app/controllers/info_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/info_controller.rb b/app/controllers/info_controller.rb index e147639..7c1b631 100644 --- a/app/controllers/info_controller.rb +++ b/app/controllers/info_controller.rb @@ -8,8 +8,8 @@ class InfoController < ApplicationController end def show - @prev = Info.where(["id < ?", @info.id]).order(:title).last || Info.order(:title).last - @next = Info.where(["id > ?", @info.id]).order(:title).first || Info.order(:title).first + @prev = Info.where(["title < ?", @info.title]).order(:title).last || Info.order(:title).last + @next = Info.where(["title > ?", @info.title]).order(:title).first || Info.order(:title).first end def new