2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00
discourse/app/serializers/permalink_serializer.rb

24 lines
491 B
Ruby
Raw Normal View History

2015-07-15 18:24:28 +05:30
class PermalinkSerializer < ApplicationSerializer
attributes :id, :url, :topic_id, :topic_title, :topic_url, :post_id, :post_url, :category_id, :category_name, :category_url, :external_url
def topic_title
object.try(:topic).try(:title)
end
def topic_url
object.try(:topic).try(:url)
end
def post_url
object.try(:post).try(:url)
end
def category_name
object.try(:category).try(:name)
end
def category_url
object.try(:category).try(:url)
end
2015-07-15 18:24:28 +05:30
end