Skip to content

Conversation

@shebson
Copy link
Contributor

@shebson shebson commented Jan 6, 2014

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

Copy link
Member

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?

Copy link
Member

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.

Copy link
Contributor Author

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.

@spikebrehm
Copy link
Member

Thanks @shebson, this is an elegant way to solve this problem. The renaming to getModelOrCollectionName and associated variables seems a little unnecessary, or at least the name is very long. Something better?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix blank modelName when collection uses generic BaseModel

3 participants