Skip to content

defineResource({ name: 'user', meta: { whatever: 'I want' } }); #57

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

Closed
kentcdodds opened this issue May 16, 2014 · 2 comments
Closed

defineResource({ name: 'user', meta: { whatever: 'I want' } }); #57

kentcdodds opened this issue May 16, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@kentcdodds
Copy link
Contributor

I can do this currently, I just wanted to bring this to your attention so people don't start passing options to defineResource and screw themselves up when you want to add features... For example...
I'm using angular-data today and do this:

DS.defineResource({
  name: 'user',
  foo: 'bar'
});

Then tomorrow, you decide that we really need to add another option to defineResource and we want to call it foo.

I upgrade.

The internet breaks... Or something...

Here's my proposed solution: Give us a field for stuff like this called meta and then explicitly create the definition, don't just make the object we pass you as the definition. We will hate ourselves later I'm sure...

@jmdobry
Copy link
Member

jmdobry commented May 16, 2014

That's a good idea. I can just make a rule that going forward, meta is reserved for devs to use.

I don't reuse the object that's passed to defineResource, I create a new Resource that uses some prototype stuff to easily hook into default values and lesser default values configured via a provider.

@jmdobry jmdobry added this to the 0.9.0 milestone May 16, 2014
@jmdobry jmdobry self-assigned this May 16, 2014
@jmdobry
Copy link
Member

jmdobry commented May 18, 2014

This just needs to be documented, and then I guess this is done.

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

No branches or pull requests

2 participants