Mgcs
March 18, 2021, 2:12am
1
Hi!
I’m trying to figure how to add more info to created_by in a GET request to a topic ID.
From what I could see, it uses BasicUserSerializer, which returns:
"created_by": {
"id": 1,
"username": "Name",
"name": "Name",
"avatar_template": "/user_avatar_url"
}
If I wanted to add other details, such as likes_give, likes_received, created_at, and other relevant info from the topic OP, how would I do that?
I was looking at add_to_serializer and I’ve tried doing something like this, which fails and breaks every page:
#plugin.rb
after_initialize do
add_to_serializer(:basic_user, :created_at) do
object.created_at
end
end
Thanks!
4 Likes
Mgcs
March 22, 2021, 3:22am
2
Bumping this
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.
sam
(Sam Saffron)
March 22, 2021, 3:49am
3
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 Likes
fzngagan
(Faizaan Gagan)
March 22, 2021, 7:37am
4
Cheers from Pavilion
I’ve solved this, it is indeed complicated. I’ll send you a PM regarding this.
5 Likes
fzngagan
(Faizaan Gagan)
April 8, 2021, 5:54am
5
This task was completed and paid for promptly. Was nice working with @Mgcs
6 Likes
system
(system)
Closed
May 8, 2021, 5:55am
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.