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

Camel Case models break scaffolded views in coffee mode #4

Open
NeilBryant opened this issue Apr 16, 2013 · 0 comments
Open

Camel Case models break scaffolded views in coffee mode #4

NeilBryant opened this issue Apr 16, 2013 · 0 comments

Comments

@NeilBryant
Copy link

I need a table for 'packages'. Initializing with --coffee, it won't let me make that table, saying it's a reserved word. It will create it happily if the project is javascript, but I want coffee, and I don't see a NOT coffee switch for the scaffolding.

So I renamed it 'appPackage', trying to stick to javascripty formatting.

That breaks the view--at least, the add view, with:

12| h1 New apppackage
13|
> 14| - var form = formFor(apppackage, {action: pathTo.apppackages(), method: 'POST', id: "apppackage_form", class: 'form-horizontal'})
15|
16| != form.begin()
17| include _form

It looks like the schema and models are keeping the CamelCase, but the views are lowercasing everything?

---- Comment from Anatoliy ----
There's no way to correct this behavior currently using generators. But I
agree this makes life harder sometimes. To fix it need to come up with some
naming convention in model/crud generator. For example always assume model
is camelCase singular word. And then just produce all forms used in app:
lowerCase first camelcase singular for instance name, upperCase first
camelcase singilar for class name, lowerCase first plural for collections.
It also may require some fixes in routing helpers generators. Probably it
worth opening issue in co-generators package.

---- Comment from Neil ----
There's never going to be a way to always get automated plurals and casing correct; there're just too many mutations. It might be simpler in other languages, but English at least is about 90% edge-cases.

I would vote for the above (assume camelCase singular), but possibly with override options (-plural xxxx). .NET uses a -tablename option. -collection, or similar might be good options.

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

1 participant