mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 13:21:29 +00:00
Annotate & fix style
This commit is contained in:
parent
5f53893756
commit
a0318805e7
2 changed files with 15 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
# forum_id :integer
|
||||
# group_id :integer
|
||||
# access :integer
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# position :integer
|
||||
#
|
||||
|
||||
require "spec_helper"
|
||||
|
|
Loading…
Reference in a new issue