Skip to content
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

nodal g:model Address generates 'Addres' model, migration #164

Open
paulhart opened this issue Feb 10, 2016 · 7 comments
Open

nodal g:model Address generates 'Addres' model, migration #164

paulhart opened this issue Feb 10, 2016 · 7 comments

Comments

@paulhart
Copy link

(Tested in 0.7.0)

The description says it all, but:

$ nodal g:model Address
Create: ./app/models/addres.js
Create: ./db/migrations/2016021002484238__create_addres.js
$ 

I'll add that I'm aware that nodal g:model Addresses does the expected action, creating an Address model. I'm raising this primarily because the screencast gives examples of using singular names for models (i.e. nodal g:model Tweet), so I believe there's an expectation that model names should be provided as singular.

@abossard
Copy link
Contributor

Still exists in 0.7.3 and I think model names should not be depluralized, but used at is.
But besides that, this is not an error of nodal per se, but of the inflect library. See here:
pksunkara/inflect#20

@abossard
Copy link
Contributor

What about:

let modelName = inflect.camelize(args[0][0]); 

instead of using classify? Than it would not be singular.

@keithwhor
Copy link
Owner

want to have model names singularized. makes more sense. new User() not new Users().

Gonna have to submit a PR on the inflect library.

@abossard
Copy link
Contributor

Hi Keith,

in the documentation here: https://github.com/keithwhor/nodal/blob/master/LEARN.md#models you suggest to use ModelName which implies using singular camemlized names. Why do you call classify on it? Just for the case, that the user would supply a not camelized name?

Anyways, what about just using camelized, which does not have any effect on an already camelized word and emphase in the documentation, that singular names should be used?

I'll quickly wind up a pull request, but feel free to dismiss it.

@keithwhor
Copy link
Owner

Yeah. Just incase the user doesn't do it correctly. I'd rather patch the real issue here, and that's the inflect library not performing as expected.

@abossard
Copy link
Contributor

I thought about it a bit and I think the user should decide, whether he wants plural or singular name and nodal should use Camelize and Underscore instead of Tableize and Classify.

@keithwhor
Copy link
Owner

@abossard Initially I disagreed, but I'm actually leaning towards dropping the inflect package altogether. It produces unwanted side effects and is a bit too magical. I'm going to see what it looks like to remove.

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

No branches or pull requests

3 participants