Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

easy way to get contextualized models #1251

Closed
drewfish opened this issue Sep 25, 2013 · 2 comments
Closed

easy way to get contextualized models #1251

drewfish opened this issue Sep 25, 2013 · 2 comments

Comments

@drewfish
Copy link
Contributor

The current ac.models.get() takes the YUI module name as the argument. This means that I (as an app developer) need to know ahead of time which YUI module to use for a model.

The feature request is to augment ac.models.get() to take the model name (for example, foo for models/foo.server.js) and to use the correct model for the current context.

@drewfish
Copy link
Contributor Author

As it turns out, the mojit resolution process already has this exact mapping. (It can be found at ac.command.instance.models.)

For backwards compatibility we should probably first look in Y.mojito.models[name] then fallback to Y.mojito.models[instance.models[name]] which implements this feature. (Plus good error checking of course.)

@caridy
Copy link
Contributor

caridy commented Sep 25, 2013

Sounds good to me!

lzhan pushed a commit to lzhan/mojito that referenced this issue Sep 30, 2013
lzhan pushed a commit that referenced this issue Oct 22, 2013
fix issue #1251 easy way to get contextualized models
lzhan pushed a commit to lzhan/mojito that referenced this issue Nov 8, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants