Giter Club home page Giter Club logo

Comments (4)

yosiat avatar yosiat commented on August 22, 2024 1

@BorisBresciani I can add support for has_many :pankos, embed: :ids in serializer like AMS.

wdyt?

from panko_serializer.

BorisBresciani avatar BorisBresciani commented on August 22, 2024

It is a good idea or if not to do as simple attributes without specifying "has_many" like my example

from panko_serializer.

yosiat avatar yosiat commented on August 22, 2024

It's simple to do embed because at serializer definition time I don't know which model is serialized in advance so I can't tell if panko_ids is field or method and detecting this at runtime can be a huge performance loss.

I have two options to tackle this:

  • Move to strict serializes and don't allow polymorphic serializers, so in addition to attributes, you will specify model Post - and I can tell automatically which method it is, gather type information etc.
  • At runtime detect which model I am serializing and cache results of attributes mapping per serializer.

Both solutions will take some time to develop if you can wait two weeks (at max), I will implement them now and in the meanwhile you will do:

attributes :panko_ids
def panko_ids
  object.panko_ids
end

or

attributes :panko_ids
delegate :panko_ids to: :object

from panko_serializer.

BorisBresciani avatar BorisBresciani commented on August 22, 2024

Hi,

The second solution seems better

from panko_serializer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.