diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 82a83869f80..0eae8c24ba8 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 be414d6b59d..93f3cfab50e 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,