2
0
mirror of https://github.com/moebooru/moebooru synced 2025-09-06 08:55:08 +00:00
Files
moebooru/app/models/post/comment_methods.rb

12 lines
279 B
Ruby
Raw Normal View History

module Post::CommentMethods
def self.included(m)
2013-07-14 13:20:20 +09:00
m.has_many :comments, lambda { order "id" }
end
def recent_comments
# reverse_order to fetch last 6 comments
# reversed in the last to return from lowest id
comments.reverse_order.limit(6).reverse
end
end