Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Matteo Ferrando
    @chamini2
    That seems right
    James Dixon
    @jamesdixon
    typeForModel maps to typeForAttribute in the serializer
    Matteo Ferrando
    @chamini2
    Yeah, cool.
    And should we pluralize by default?
    James Dixon
    @jamesdixon
    sorry, i meant we end up with typeForModel and keyForAttribute
    Matteo Ferrando
    @chamini2
    I understood it like that :laughing:
    James Dixon
    @jamesdixon
    :+1:
    Matteo Ferrando
    @chamini2
    I think we should disable pluralizeType by default
    Because in the link generation part, we pluralize the links, and then we let the types be pluralized by the serializer
    So we take care of half the problem (the links) and let the other half to the serializer
    Maybe we could pass by default our pluralize function to the serializer, so it uses our own
    James Dixon
    @jamesdixon
    ok, so then you're proposing we pass a function to typeForAttribute that pluralizes the type by default?
    Sounds like we're on the same page
    Matteo Ferrando
    @chamini2
    Yeah, cool
    James Dixon
    @jamesdixon
    Ok, I'm going to write this down in the API thread on the repo
    Matteo Ferrando
    @chamini2
    Great, thanks
    James Dixon
    @jamesdixon
    Thank you!
    @chamini2
    another question
    Matteo Ferrando
    @chamini2
    Yeah
    James Dixon
    @jamesdixon
    with regard to typeForModel replacing relationTypes: currently relationTypes accepts an object of relation names to override. However, what if you want to override a relation name AND specify a function to change the model type?
    Nevermind
    I think it's essentially covered or do you see this as a possibility
    ?
    Matteo Ferrando
    @chamini2
    It doesn’t override the relation name
    It says for this relation, use this type
    James Dixon
    @jamesdixon
    Yes, that's what I meant. I should have been more specific
    Matteo Ferrando
    @chamini2
    So we actually just wrap the object in a function. If the user wants something more complex, they can pass a function that manages all these cases. (edit)
    James Dixon
    @jamesdixon
    Yeah, it seems that just passing a function makes sense and not worrying about passing an object.
    We can certainly keep that functionality, but only accepting a function would simplify things on our end.
    Matteo Ferrando
    @chamini2
    Mmhh, I actually implemented it to make things easier for me haha
    James Dixon
    @jamesdixon
    Haha fair enough
    Ok, sounds good!
    Matteo Ferrando
    @chamini2
    I use it like mapper.map(model, type, {relationTypes: {avatar: 'media'}})
    A question, @jamesdixon: do you currently use keyForAttribute?
    James Dixon
    @jamesdixon
    I do
    I camelCase my keys
    Matteo Ferrando
    @chamini2
    Ok, cool
    James Dixon
    @jamesdixon
    Just updated that issue
    We'll see if anyone else has any feedback
    Matteo Ferrando
    @chamini2
    Hey, keyForAttribute should just accept functions on our side or also strings?
    James Dixon
    @jamesdixon
    Should probably just keep it to a function just in case they decide to remove built-in support
    What do you think?
    Matteo Ferrando
    @chamini2
    Cool, change it in the proposal then :)
    James Dixon
    @jamesdixon
    Do you have an opinion one way or another?
    Matteo Ferrando
    @chamini2
    I also like the just functions approach
    James Dixon
    @jamesdixon
    :+1:
    Updated!
    Matteo Ferrando
    @chamini2
    Cool :+1:
    Matteo Ferrando
    @chamini2
    Hey @jamesdixon, I don't understand very well #74. I thought the pivot was for belongsToMany relations. Do you mind explaining it a bit here or in the PR to better understand what it achieves?