# Name mangling in scaffolding generator

**URL:** <https://www.ruby-forum.com/t/name-mangling-in-scaffolding-generator/158013>\
**Category:** Rails\
**Created:** [January 17, 2009, 11:01pm UTC](https://www.ruby-forum.com/t/name-mangling-in-scaffolding-generator/158013 "2009-01-17T23:01:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cleca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cleca](https://www.ruby-forum.com/u/cleca)\
**Post date:** [January 17, 2009, 11:01pm UTC](https://www.ruby-forum.com/t/name-mangling-in-scaffolding-generator/158013/1 "2009-01-17T23:01:00Z")

</div>

The scaffolding generator does some name mangling, for example it does  
pluralization.

However, it looks like there are some other rules and I do not  
understand them. I did a

script/generate scaffold EVENTLOG whenSec:integer

and I get the correct model, but I do get a number of underscores in  
numerous places, such as:

app/views/eventlo\_gs/index.html.erb  
app/controllers/eventlo\_gs\_controller.rb  
test/functional/eventlo\_gs\_controller\_test.rb  
app/helpers/eventlo\_gs\_helper.rb  
route map.resources :eventlo\_gs

So: What situation triggers that added underscore and is there a  
possibility to turn it off?

Thanx  
C.

---

<div class="post-metadata">

**Author:** ![cleca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cleca](https://www.ruby-forum.com/u/cleca)\
**Post date:** [January 22, 2009, 9:58pm UTC](https://www.ruby-forum.com/t/name-mangling-in-scaffolding-generator/158013/2 "2009-01-22T21:58:21Z")

</div>

Push 🙂

Ideas anyone ? 🙂

---

<div class="post-metadata">

**Author:** ![cleca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cleca](https://www.ruby-forum.com/u/cleca)\
**Post date:** [January 23, 2009, 1:37am UTC](https://www.ruby-forum.com/t/name-mangling-in-scaffolding-generator/158013/3 "2009-01-23T01:37:11Z")

</div>

On 22 Jan 2009, at 20:57, X wrote:

> Push 🙂
> 
> Ideas anyone ? 🙂

Probably because it’s not expecting you to give it something all in  
caps. I’d guess it’s doing pluralize then camelize:

“EVENTLOG”.pluralize #=\> “EVENTLOGs”  
and then it’s just confused.  
“EVENTLOGs”.underscore =\> “eventlo\_gs”

Fred

---

<div class="post-metadata">

**Author:** ![cleca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cleca](https://www.ruby-forum.com/u/cleca)\
**Post date:** [January 23, 2009, 4:11am UTC](https://www.ruby-forum.com/t/name-mangling-in-scaffolding-generator/158013/4 "2009-01-23T04:11:38Z")

</div>

I was thinking the same thing. Try just capitalizing the first letter  
and see if that fixes it.

On Jan 22, 6:36 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![cleca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/5f9b8f/32.png) [@cleca](https://www.ruby-forum.com/u/cleca)\
**Post date:** [January 26, 2009, 11:19pm UTC](https://www.ruby-forum.com/t/name-mangling-in-scaffolding-generator/158013/5 "2009-01-26T23:19:09Z")

</div>

Yep. Thanx.
