-
Notifications
You must be signed in to change notification settings - Fork 312
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
Use collectionName for ModelStore key when modelName isn't set #253
base: master
Are you sure you want to change the base?
Conversation
@@ -121,7 +129,7 @@ ModelUtils.prototype.underscorize = function(name) { | |||
* -> "" | |||
* MyClass.id = "MyClass" | |||
*/ | |||
ModelUtils.prototype.modelName = function(modelOrCollectionClass) { | |||
ModelUtils.prototype.modelOrCollectionName = function(modelOrCollectionClass) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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