discourse/app/serializers/top_list_serializer.rb

13 lines
242 B
Ruby
Raw Normal View History

2013-12-23 18:50:36 -05:00
class TopListSerializer < ApplicationSerializer
TopTopic.periods.each do |period|
2014-01-13 19:02:14 -05:00
attribute period
2013-12-23 18:50:36 -05:00
define_method(period) do
2014-01-13 19:02:14 -05:00
TopicListSerializer.new(object[period], scope: scope).as_json if object[period]
2013-12-23 18:50:36 -05:00
end
2014-01-13 19:02:14 -05:00
2013-12-23 18:50:36 -05:00
end
end