2
0
mirror of https://github.com/moebooru/moebooru synced 2025-10-07 13:46:17 +00:00
Files
moebooru/app/models/post/comment_methods.rb

12 lines
270 B
Ruby
Raw Normal View History

module PostCommentMethods
def self.included(m)
m.has_many :comments, :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