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

Base class serializer should be picked up for STI models #183

Closed
mathieujobin opened this issue Apr 23, 2018 · 3 comments
Closed

Base class serializer should be picked up for STI models #183

mathieujobin opened this issue Apr 23, 2018 · 3 comments

Comments

@mathieujobin
Copy link

my application use SingleTableInheritence models, and using ActiveModelSerialiser, the parent class serializer is automatically picked up. with fast_jsonapi, a default built-in serializer is used, and thus mine is ignored.

models:

class Animal < ActiveRecord::Base; end
class Cat < Animal; end
class Dog < Animal; end
class AnimalSerializer
  include FastJsonapi::ObjectSerializer
  attribute(:custom) { "we love ruby" }
end

class ZooController < ApplicationController
  def index
    render json: Animal.all
  end
end

my serializer was picked up with AMS but not this gem.

Thank you

@shishirmk
Copy link
Collaborator

Yes this is know issue. #155 took care of part of it not the entire problem. If you have some time to contribute please try to complete the solution from #155

@shishirmk
Copy link
Collaborator

@mathieujobin I was able to put together a pull request to make inheritance work as expected. #203 has the pull request for it

@mathieujobin
Copy link
Author

sounds good, thanks

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

No branches or pull requests

2 participants