Forum: Ruby on Rails Name mangling in scaffolding generator

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
82b9e20842404d1213484655fb8e54ef?d=identicon&s=25 Clemens Cap (cleca)
on 2009-01-17 23:01
(Received via mailing list)
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.
82b9e20842404d1213484655fb8e54ef?d=identicon&s=25 Clemens Cap (cleca)
on 2009-01-22 21:58
(Received via mailing list)
Push :-)

Ideas anyone ? :-)
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-01-23 01:37
(Received via mailing list)
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
247cd3d37084a3d6794076207bd9fbd7?d=identicon&s=25 Bob Martens (Guest)
on 2009-01-23 04:11
(Received via mailing list)
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 Cheung <frederick.che...@gmail.com>
82b9e20842404d1213484655fb8e54ef?d=identicon&s=25 Clemens Cap (cleca)
on 2009-01-26 23:19
(Received via mailing list)
Yep. Thanx.
This topic is locked and can not be replied to.