discourse/app/serializers/topic_link_serializer.rb

33 lines
461 B
Ruby
Raw Normal View History

2013-02-06 03:16:51 +08:00
class TopicLinkSerializer < ApplicationSerializer
attributes :url, :title, :internal, :reflection, :clicks, :user_id
def url
object['url']
end
def title
object['title']
end
def internal
object['internal'] == 't'
end
def reflection
object['reflection'] == 't'
end
def clicks
object['clicks'] || 0
end
def user_id
object['user_id'].to_i
end
def include_user_id?
object['user_id'].present?
end
2013-02-07 23:45:24 +08:00
end