When I created a rails project as 'HelloWorld' and a controller as 'HelloWorld', ruby created control called hello_world instead of HelloWorld. Why is that? Why is it not using the name I am providing to create? Thanks.
I think that's just a Rails standard...I could be wrong though.
What is the standard? Is there a definition somewhere how the names change?
Hi --
I think that's just a Rails standard...I could be wrong though.
When I created a rails project as 'HelloWorld' and a controller as 'HelloWorld', ruby created control called hello_world instead of HelloWorld. Why is that? Why is it not using the name I am providing to create? Thanks.- Hide quoted text -
- Show quoted text -
What is the standard? Is there a definition somewhere how the names change?
It's all done according to Ruby conventions/traditions. If you generate a controller called HelloWorld, you'll get a file called hello_world_controller.rb, with a class called HelloWorldController defined inside it. That's in keeping with Ruby file-naming and class-naming conventions.
Similar things will happen with models: if you generate a Thing model, you'll get things.rb with class Thing inside it.
David
Is the controller named hello_world or just the file? My guess is that on the filesystem you have a file called hello_world_controller.rb, but if you look inside at the first line where it defines the class, it is probably called HelloWorld.
Chris
The name of controller is hello_world instead of helloworld. Thanks.