discourse/app/serializers/topic_link_serializer.rb

49 lines
668 B
Ruby
Raw Normal View History

2013-02-05 13:16:51 -06:00
class TopicLinkSerializer < ApplicationSerializer
2013-02-25 10:42:20 -06:00
attributes :url,
:title,
2013-02-19 15:08:23 -06:00
:fancy_title,
2013-02-25 10:42:20 -06:00
:internal,
:reflection,
:clicks,
2014-04-05 13:47:25 -05:00
:user_id,
:domain
2013-02-05 13:16:51 -06:00
def url
object['url']
end
def title
object['title']
end
2013-02-19 15:08:23 -06:00
def fancy_title
object['fancy_title']
end
2013-02-05 13:16:51 -06:00
def internal
object['internal'] == 't'
end
def reflection
object['reflection'] == 't'
end
def clicks
object['clicks'].to_i
2013-02-05 13:16:51 -06:00
end
def user_id
object['user_id'].to_i
end
2013-02-19 15:08:23 -06:00
2013-02-05 13:16:51 -06:00
def include_user_id?
object['user_id'].present?
end
2014-04-05 13:47:25 -05:00
def domain
object['domain']
end
2013-02-07 09:45:24 -06:00
end