algoliasearch-rails icon indicating copy to clipboard operation
algoliasearch-rails copied to clipboard

Include ActiveModel::Serializer associations

Open kyreeves opened this issue 4 years ago • 5 comments

Q A
Bug fix? yes
New feature? no
BC breaks? no
Related Issue Fix #346
Need Doc update no

Describe your change

Calling the attributes method on an instance of a ActiveModel::Serializer class does not include associations. This fixes the issue by calling the as_json method instead.

What problem is this fixing?

When using an ActiveModel Serializer to serialize your model, associations are not included.

kyreeves avatar Jun 18 '20 16:06 kyreeves

I use AMS associations extensively -- thanks for doing this, I'd love to see this get merged!

yanismydj avatar Aug 18 '20 18:08 yanismydj

hey @julienbourdeau - any chance you can review/approve this? It would help me & @ivancevich greatly!

yanismydj avatar Aug 19 '20 17:08 yanismydj

Hi @yanismydj and @kyreeves! I will deal with this PR this week :) Thanks for pinging us

chloelbn avatar Aug 25 '20 08:08 chloelbn

@chloelbn / @julienbourdeau any update on this?

siddharth28 avatar Sep 05 '21 16:09 siddharth28

Changing from reading only :attributes to reading all relationships would be a breaking change. Do you see a way in which this would be an option to make it non-breaking? Thanks!

Haroenv avatar Sep 06 '21 08:09 Haroenv