Index returned entries by id

This commit is contained in:
Claire 2023-11-15 17:10:05 +01:00
parent 9a5c6f1abe
commit 379c226d70
2 changed files with 2 additions and 2 deletions

View file

@ -22,7 +22,7 @@ class Api::V1::AccountsController < Api::BaseController
override_rate_limit_headers :follow, family: :follows
def index
render json: @accounts, each_serializer: REST::AccountSerializer
render json: @accounts.map { |account| ActiveModelSerializers::SerializableResource.new(account, serializer: REST::AccountSerializer, scope: current_user, scope_name: :current_user).as_json }.index_by { |account| account[:id] }
end
def show

View file

@ -27,7 +27,7 @@ class Api::V1::StatusesController < Api::BaseController
def index
@statuses = cache_collection(@statuses, Status)
render json: @statuses, each_serializer: REST::StatusSerializer
render json: @statuses.map { |status| ActiveModelSerializers::SerializableResource.new(status, serializer: REST::StatusSerializer, scope: current_user, scope_name: :current_user).as_json }.index_by { |status| status[:id] }
end
def show