From fdf749770bfbc868660cc37cf8e77ce57805b7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 24 Feb 2017 12:56:13 +0100 Subject: [PATCH] remove unecessary '.limit(1)' --- app/controllers/application_controller.rb | 2 +- app/models/topic.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 82a83869f8..0eae8c24ba 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -426,7 +426,7 @@ class ApplicationController < ActionController::Base json = ApplicationController.banner_json_cache["json"] unless json - topic = Topic.where(archetype: Archetype.banner).limit(1).first + topic = Topic.where(archetype: Archetype.banner).first banner = topic.present? ? topic.banner : {} ApplicationController.banner_json_cache["json"] = json = MultiJson.dump(banner) end diff --git a/app/models/topic.rb b/app/models/topic.rb index be414d6b59..93f3cfab50 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -848,7 +848,7 @@ SQL end def banner - post = self.posts.order(:post_number).limit(1).first + post = self.ordered_posts.first { html: post.cooked,