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

Transforms have no idea about attributes #3111

Closed
louy opened this issue May 26, 2015 · 2 comments
Closed

Transforms have no idea about attributes #3111

louy opened this issue May 26, 2015 · 2 comments

Comments

@louy
Copy link

louy commented May 26, 2015

I'd like to discuss an issue that I have faced recently using Ember data.

As I see it, the current functionality of Transforms is very limited, which shouldn't be the case. Specifically, there is no way to know anything about the Model or the attribute in Transform which makes a few use cases hard to implement. For example, ember-data.model-fragments#96.

What I suggest here is that there could be a way for the transform class to know which model and/or which attribute it's serializing/deserializing, so that it can have far more functionality. Then it will also be able to read attribute's meta and apply some filters according to that. I think there are many use cases for this (like String.trim().)

I'm not sure if this fits the concept of transform, but I believe it would be a good thing to have. What do you think?

@louy louy changed the title Transforms have no idea about Models Transforms have no idea about attributes May 26, 2015
@igorT
Copy link
Member

igorT commented May 29, 2015

I know @wycats was against this before for simplicity sake, but I had hacked together in couple apps, so seems beneficial. I'll tag it for review

@fivetanley
Copy link
Member

We have chosen to not support this API. @tomdale says this introduces too much complexity. We have decided to implement emberjs/rfcs#1 instead, which should allow you to do this kind of thing, even if it is less dynamic in nature.

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

4 participants