Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Weird scaffold behavior #4374

Closed
apolzon opened this Issue · 6 comments

5 participants

Chris Apolzon salemine Wes Morgan Jeremy Friesen Carlos Antonio da Silva
Chris Apolzon

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

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

I think this issue can be closed ?

Chris Apolzon

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.

Wes Morgan

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.

Wes Morgan

This pull request fixes the problem: #5177

Jeremy Friesen

A placemarker for follow-up (@jeremyf)

Carlos Antonio da Silva

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
Something went wrong with that request. Please try again.