Rail Class name to File name

Can anyone please tell me which function in Rail that convert the class
name into the file name

like when we do ruby script/generate RubyOnRail
it generate the ruby_on_rail.rb controller

Thanks

Can anyone please tell me which function in Rail that convert the class
name into the file name

This shoud do the trick:

classname = “foo”
filname = classname.underscore

tisp