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

Question: Is it possible to extend Changeset class ? #178

Closed
janmisek opened this issue Apr 26, 2017 · 5 comments
Closed

Question: Is it possible to extend Changeset class ? #178

janmisek opened this issue Apr 26, 2017 · 5 comments

Comments

@janmisek
Copy link

I am looking into possibility to add custom computed properties on changeset. Is it possible to extend Changeset class?

Thanks in advance.

@SuperCoolFrog
Copy link
Contributor

The addon exports the class which is an ember object that you can extend on.
I wrote this quick twiddle but it should point you in the right direction.
Twiddle

Extend API Guide
https://emberjs.com/api/classes/Ember.Object.html#method_extend

@janmisek
Copy link
Author

Thanks alot for explanation I found myself yesterday.

I would also suggest to include this info in readme, because export of changeset class is nowhere documented, default export is "ember-non-extensible" constructror function.

Btw: why the original ember class is wrapped to classic js constructor function exported by default - is it to make original class semi-private or the reason is e.g typescript compat.

@bgentry
Copy link
Contributor

bgentry commented Mar 24, 2018

The example in that Twiddle doesn't actually work. If you use that method, then the changeset's obj, validationMap, etc are all fixed to the default values ({}) and there is no way to change them. It does not appear that the Changeset class is actually extensible.

Is that intentional? Does it need to be that way?

@snewcomer
Copy link
Collaborator

We should ensure this works with 3.0.0....

@snewcomer
Copy link
Collaborator

This is now documented in the README!

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

No branches or pull requests

5 participants