mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-11-15 09:21:25 +00:00
Hound
This commit is contained in:
parent
4377d07095
commit
4cfa9a7e0d
1 changed files with 13 additions and 13 deletions
|
@ -42,20 +42,20 @@ class Topic < ActiveRecord::Base
|
||||||
acts_as_readable
|
acts_as_readable
|
||||||
|
|
||||||
def self.recent_topics
|
def self.recent_topics
|
||||||
self.find_by_sql %q{
|
find_by_sql %q{
|
||||||
SELECT DISTINCT topics.*
|
SELECT DISTINCT topics.*
|
||||||
FROM (SELECT id, topic_id
|
FROM (SELECT id, topic_id
|
||||||
FROM posts
|
FROM posts
|
||||||
ORDER BY id DESC
|
ORDER BY id DESC
|
||||||
LIMIT 20) AS T
|
LIMIT 20) AS T
|
||||||
INNER JOIN topics
|
INNER JOIN topics
|
||||||
ON T.topic_id = topics.id
|
ON T.topic_id = topics.id
|
||||||
INNER JOIN forums
|
INNER JOIN forums
|
||||||
ON forums.id = topics.forum_id
|
ON forums.id = topics.forum_id
|
||||||
LEFT OUTER JOIN forumers
|
LEFT OUTER JOIN forumers
|
||||||
ON forumers.forum_id = forums.id
|
ON forumers.forum_id = forums.id
|
||||||
WHERE forumers.id IS NULL
|
WHERE forumers.id IS NULL
|
||||||
LIMIT 5
|
LIMIT 5
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue