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

Weird scaffold behavior #4374

Closed
apolzon opened this issue Jan 7, 2012 · 6 comments
Closed

Weird scaffold behavior #4374

apolzon opened this issue Jan 7, 2012 · 6 comments

Comments

@apolzon
Copy link

apolzon commented Jan 7, 2012

3.2.0.rc2, ruby-1.9.2-p290

rails g scaffold slices title:string results in odd behavior.

It warns that its using singular (okay, my bad, thanks), which is fine but the generated controllers and views use Slouse as the model name instead of Slice. The model was created correctly as Slice.

@salemine
Copy link

Take a look at config/initializers/inflections.rb and add to the block:
inflect.irregular 'slice', 'slices'

I think this issue can be closed ?

@apolzon
Copy link
Author

apolzon commented Jan 17, 2012

I can do that, however it still seems like a bug since the model layer was generated correctly using Slice, and the controller should really be doing Slice.all, not Slices (or Slouse) .all

Feel free to close the issue if you disagree.

@cap10morgan
Copy link
Contributor

I tried this on rails HEAD and it is still broken. It appears the ActiveSupport::Inflector doesn't anchor the regex that looks for (m|l)ice$ to the start of the string. So any word that ends in (m|l)ice will match as a plural and AS will incorrectly turn it into ...ouse for the model name.

Here is a list of words from /usr/share/dict that end in (m|l)ice:

accomplice
Alice
allice
amice
chalice
cilice
complice
Ellice
enchalice
fortalice
malice
mice
police
prepolice
pumice
pummice
resplice
slice
splice
supplice
surplice
Triplice
undersplice
unsurplice

As you can see, many of them are not plurals of a word that ends in ...ouse.

Fix forthcoming.

@cap10morgan
Copy link
Contributor

This pull request fixes the problem: #5177

@jeremyf
Copy link
Contributor

jeremyf commented Apr 28, 2012

A placemarker for follow-up (@jeremyf)

@carlosantoniodasilva
Copy link
Member

Pull request was merged, closing here, thanks!

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

5 participants