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.
On Jun 11, 2:21 pm, longint [email protected] wrote:
Thanks.- Hide quoted text -
- Show quoted text -
What is the standard? Is there a definition somewhere how the names
change?
Hi –
On Mon, 11 Jun 2007, DBC User wrote:
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
–
- Books:
RAILS ROUTING (new! http://safari.awprofessional.com/9780321509246)
RUBY FOR RAILS (http://www.manning.com/black) - Ruby/Rails training
& consulting: Ruby Power and Light, LLC (http://www.rubypal.com)
On Jun 11, 2:45 pm, “Chris Johnston” [email protected] wrote:
– Antoine de Saint-Exupery
The name of controller is hello_world instead of helloworld.
Thanks.
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
On 6/11/07, DBC User [email protected] wrote:
–
You know you’ve achieved perfection in design, Not when you have nothing
more to add, But when you have nothing more to take away.
– Antoine de Saint-Exupery