2
0
mirror of https://github.com/moebooru/moebooru synced 2025-09-05 16:35:12 +00:00
Files
moebooru/app/models/post/comment_methods.rb
2014-11-20 17:50:28 +09:00

12 lines
279 B
Ruby

module Post::CommentMethods
def self.included(m)
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