Use collectionName for ModelStore key when modelName isn't set#253
Use collectionName for ModelStore key when modelName isn't set#253shebson wants to merge 4 commits intorendrjs:masterfrom shebson:fix-modelstore-key
Conversation
shared/modelUtils.js
Outdated
There was a problem hiding this comment.
Maybe we can find a less verbose name for this? Perhaps we could use resource instead of modelOrCollection?
There was a problem hiding this comment.
It actually describes exactly what the method does. I think the problem here is not the name but rather doing two things at once.
There was a problem hiding this comment.
I absolutely agree that modelOrCollectionName is unwieldy. I chose it for consistency with modelOrCollection, a variable which is used in the fetcher and view engine, but I agree that resourceName is better.
I think that this is just a naming issue, though, and not a problem of trying to do two things in one method. This method takes a constructor and returns its underscorized id. I see that as one task with multiple applications.
|
Thanks @shebson, this is an elegant way to solve this problem. The renaming to |
When a model does not have a modelName and belongs to collection that is named, use the collectionName in place of the modelName when generating the ModelStore key.
Fixes #151. cc @lo1tuma