Weird scaffold behavior #4374

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

Comments

Projects
None yet
5 participants
@apolzon

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

This comment has been minimized.

Show comment Hide comment
@salemine

salemine Jan 17, 2012

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

I think this issue can be closed ?

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

This comment has been minimized.

Show comment Hide comment
@apolzon

apolzon 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.

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

This comment has been minimized.

Show comment Hide comment
@cap10morgan

cap10morgan Feb 25, 2012

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.

Contributor

cap10morgan commented Feb 25, 2012

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

This comment has been minimized.

Show comment Hide comment
@cap10morgan

cap10morgan Feb 25, 2012

Contributor

This pull request fixes the problem: #5177

Contributor

cap10morgan commented Feb 25, 2012

This pull request fixes the problem: #5177

@jeremyf

This comment has been minimized.

Show comment Hide comment
@jeremyf

jeremyf Apr 28, 2012

Contributor

A placemarker for follow-up (@jeremyf)

Contributor

jeremyf commented Apr 28, 2012

A placemarker for follow-up (@jeremyf)

@carlosantoniodasilva

This comment has been minimized.

Show comment Hide comment
@carlosantoniodasilva

carlosantoniodasilva Apr 30, 2012

Member

Pull request was merged, closing here, thanks!

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