mirror of
https://github.com/wahyd4/libr-2.git
synced 2026-08-09 05:15:53 +10:00
#8 Add source url
This commit is contained in:
@@ -11,4 +11,8 @@ class EMPostSerializer < EMSourceSerializer
|
||||
def description
|
||||
object.summary
|
||||
end
|
||||
|
||||
def source_url
|
||||
api_v1_post_path(object)
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,8 @@
|
||||
|
||||
class EMSourceSerializer < ActiveModel::Serializer
|
||||
attributes :id, :title, :img, :description
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
attributes :id, :title, :img, :description, :source_url
|
||||
|
||||
def title
|
||||
|
||||
@@ -13,4 +16,8 @@ class EMSourceSerializer < ActiveModel::Serializer
|
||||
|
||||
end
|
||||
|
||||
def source_url
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -13,4 +13,8 @@ class EMUserSerializer < EMSourceSerializer
|
||||
"『暂无描述』"
|
||||
end
|
||||
|
||||
def source_url
|
||||
api_v1_user_path(object)
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user