discourse/app/serializers/top_list_serializer.rb
Sam Saffron cac80cdc3b DEV: more send -> public_send changes
This is a work in progress commit for more send to public_send conversions

Also adds some comments for cases where we need to keep send
2019-05-07 11:58:06 +10:00

24 lines
444 B
Ruby

class TopListSerializer < ApplicationSerializer
attributes :can_create_topic,
:draft,
:draft_key,
:draft_sequence
def can_create_topic
scope.can_create?(Topic)
end
TopTopic.periods.each do |period|
attribute period
define_method(period) do
if resolved = object.public_send(period)
TopicListSerializer.new(resolved, scope: scope).as_json
end
end
end
end