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
def self.recent_topics
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 forumers on forums.id = forumers.forum_id")
.order("posts.id desc")
.where("forumers.id IS NULL")
.select("DISTINCT topic_id")
.limit(5).map(&:topic)
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 forumers on forums.id = forumers.forum_id").
order("posts.id desc").
where("forumers.id IS NULL").
select("DISTINCT topic_id").
limit(5).
map(&:topic)
end
def to_s

View file

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