Annotate & fix style

This commit is contained in:
Chris Blanchard 2015-08-20 19:36:01 +01:00
parent 5f53893756
commit a0318805e7
2 changed files with 15 additions and 15 deletions

View file

@ -42,13 +42,14 @@ class Topic < ActiveRecord::Base
acts_as_readable acts_as_readable
def self.recent_topics def self.recent_topics
Post.joins("LEFT OUTER JOIN topics ON topics.id = posts.topic_id") Post.joins("LEFT OUTER JOIN topics ON topics.id = posts.topic_id").
.joins("LEFT OUTER JOIN forums on forums.id = topics.forum_id") joins("LEFT OUTER JOIN forums on forums.id = topics.forum_id").
.joins("LEFT OUTER JOIN forumers on forums.id = forumers.forum_id") joins("LEFT OUTER JOIN forumers on forums.id = forumers.forum_id").
.order("posts.id desc") order("posts.id desc").
.where("forumers.id IS NULL") where("forumers.id IS NULL").
.select("DISTINCT topic_id") select("DISTINCT topic_id").
.limit(5).map(&:topic) limit(5).
map(&:topic)
end end
def to_s def to_s

View file

@ -1,14 +1,13 @@
# == Schema Information # == Schema Information
# #
# Table name: forums # Table name: forumers
# #
# id :integer not null, primary key # id :integer not null, primary key
# title :string(255) # forum_id :integer
# description :string(255) # group_id :integer
# category_id :integer # access :integer
# created_at :datetime # created_at :datetime
# updated_at :datetime # updated_at :datetime
# position :integer
# #
require "spec_helper" require "spec_helper"