mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
19 lines
380 B
Ruby
19 lines
380 B
Ruby
class TopListSerializer < ApplicationSerializer
|
|
|
|
attributes :can_create_topic,
|
|
:yearly,
|
|
:monthly,
|
|
:weekly,
|
|
:daily
|
|
|
|
def can_create_topic
|
|
scope.can_create?(Topic)
|
|
end
|
|
|
|
TopTopic.periods.each do |period|
|
|
define_method(period) do
|
|
TopicListSerializer.new(object[period], scope: scope).as_json
|
|
end
|
|
end
|
|
|
|
end
|