created_by에 정보 추가 (user 및 user_summary에서)

안녕하세요!

GET 요청을 통해 토픽 ID의 created_by에 더 많은 정보를 추가하는 방법을 알아보고 있습니다.
확인해 본 바로는 BasicUserSerializer를 사용하며, 이는 다음과 같은 내용을 반환합니다:

"created_by": {
  "id": 1,
  "username": "Name",
  "name": "Name",
  "avatar_template": "/user_avatar_url"
}

좋아요를 준 수(likes_give), 좋아요를 받은 수(likes_received), 생성 일시(created_at) 및 토픽 작성자(OP)와 관련된 기타 정보를 추가하고 싶은데, 어떻게 해야 할까요?

add_to_serializer를 살펴보고 다음과 같이 시도해 보았지만, 실패하여 모든 페이지가 깨졌습니다:

#customization:plugin.rb
after_initialize do
  add_to_serializer(:basic_user, :created_at) do
    object.created_at
  end
end

감사합니다!

4개의 좋아요

Bumping this :slight_smile:
If you know how to solve this, talk to me, I can pay you for the info too. Send me a private message if that is better.

probably cause it is not being selected, this is pretty complicated patch you are after, since this is for pay I think Marketplace is a good spot.

4개의 좋아요

Cheers from Pavilion
I’ve solved this, it is indeed complicated. I’ll send you a PM regarding this.

5개의 좋아요

This task was completed and paid for promptly. Was nice working with @Mgcs

6개의 좋아요

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.