Model name should start with capital letter when setup the auth
3adel-bassiony opened this issue ยท 6 comments
When I set up the authentication and run this command:
node ace configure @adonisjs/auth
it asked me to enter the model name and I entered user
not User
so it created the model called user, and later I thought it was an issue so I renamed it to User but the git didn't notice the case sensitive change so on my local is User
but on GitHub is user
I fixed it by renaming it to the correct one User
I think when setup the auth it should be following the naming convention even if the user entered it with a small case, something like when creating a new model using this command line:
node ace make:model user
=> It will create a new model called User
not user
Originally posted by @3adel-bassiony in adonisjs/core#3861 (reply in thread)
Hey @3adel-bassiony! ๐๐ป
In my opinion, this is not an issue at all. You may want to have your file naming convention all lowercase. We don't want to enforce that rules.
The issue you encountered was using a non-case-sensitive OS while developing and deploying on a case-sensitive OS.
Hello @RomainLanz
Yes, the main issue was related to a case-sensitive, but if I created a new model using node ace it will create it with the first later Capital, so why I will need it with a small case? I think all models should follow the same naming convention right?
Let's say I have other models Like ( Category - Post - Comment - etc. ) why I will need the user to be user
not User
like the other models?
Which part of the systems is enforcing you to use user
and not User
?
When I create the model using node ace make:model user
it will generate a new model with the first capital letter User
, not user
, and any other new model I will create will follow the same naming convention, so when I set up the auth it should follow the same naming convention right?
Why I will create all models with the same naming convention that start with a capital letter and when I set up the auth it will be a small letter? Maybe you can make it as the node ace make:model
and if anyone wants to change the naming convention he can, I think most of people will follow the same naming convention, Actually I can enter it User
when I set up the auth but maybe many people type it user
by wrong because they thought it will be like creating any new model it will change to User
not user
and that's what happened with me
so when I set up the auth it should follow the same naming convention right?
Okay got it. So basically the node ace configure @adonisjs/auth
is not capitalising the model name, whereas the make:model
command does.
Yes exactly ๐