Refactor JSON templates to be generated with ActiveModelSerializers instead of Rabl (#4090)
This commit is contained in:
12
app/serializers/rest/search_serializer.rb
Normal file
12
app/serializers/rest/search_serializer.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::SearchSerializer < ActiveModel::Serializer
|
||||
attributes :hashtags
|
||||
|
||||
has_many :accounts, serializer: REST::AccountSerializer
|
||||
has_many :statuses, serializer: REST::StatusSerializer
|
||||
|
||||
def hashtags
|
||||
object.hashtags.map(&:name)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user