Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New use_serializer feature doesn't include associations #346

Open
ivancevich opened this issue Mar 27, 2019 · 2 comments
Open

New use_serializer feature doesn't include associations #346

ivancevich opened this issue Mar 27, 2019 · 2 comments

Comments

@ivancevich
Copy link

  • Rails version: 5.2.2.1
  • Algolia Rails integration version: 1.22.0
  • Algolia Client Version: 1.26.0
  • Language Version: Ruby 2.5.1

Description

Hi guys - I've been using the new use_serializer feature for a while now, and it's been great. Though, I've just found a problem with serializers that use the has_one association. For example:

class SingleSerializer < ActiveModel::Serializer
  attributes :id,
    :artists,
    :genre,
    :slug

  has_one :release
  has_one :label
end

In the example above, all "attributes" work just fine. Though, both :release and :label are not getting serialized/indexed into Algolia. I'm not sure why.

@julienbourdeau
Copy link
Contributor

I think in this case Rails is looking for a ReleaseSerializer and LabelSerializer. Did you define those?

@ivancevich
Copy link
Author

Hi @julienbourdeau - Yes, of course. I have both serializers defined and they're being used in other areas of the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants