From 8eb7ad21ccc8dcd8ff312009070f6792929c6276 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Sat, 14 Feb 2009 15:43:55 +0100 Subject: [PATCH] Use the controller name 'Greetings' consistently. Moreover, there seems to be a bug in Rails 2.3.0: After editing the view file apps/views/greetings/hello.html.erb in Vim, WEBrick ships the outdated content from the backup file apps/views/greetings/hello.html.erb~ instead of the intended content. Only when the 'tilde backup' file is not present, the browser shows the correct contents (both Konqueror and Firefox; you can even add a _different_ hello.html.erb~ to show completely different stuff). This bug does not occur in Rails 2.2.2. --- railties/guides/source/command_line.textile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 8a412f316f..f02677d760 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -126,10 +126,10 @@ Modules Example: Ah, the controller generator is expecting parameters in the form of +generate controller ControllerName action1 action2+. Let's make a +Greetings+ controller with an action of *hello*, which will say something nice to us. -$ ./script/generate controller Greeting hello +$ ./script/generate controller Greetings hello exists app/controllers/ exists app/helpers/ - create app/views/greeting + create app/views/greetings exists test/functional/ create app/controllers/greetings_controller.rb create test/functional/greetings_controller_test.rb @@ -139,10 +139,10 @@ $ ./script/generate controller Greeting hello Look there! Now what all did this generate? It looks like it made sure a bunch of directories were in our application, and created a controller file, a functional test file, a helper for the view, and a view file. -Let's check out the controller and modify it a little (in +app/controllers/greeting_controller.rb+): +Let's check out the controller and modify it a little (in +app/controllers/greetings_controller.rb+): -class GreetingController < ApplicationController +class GreetingsController < ApplicationController def hello @message = "Hello, how are you today? I am exuberant!" end @@ -150,7 +150,7 @@ class GreetingController < ApplicationController end -Then the view, to display our nice message (in +app/views/greeting/hello.html.erb+): +Then the view, to display our nice message (in +app/views/greetings/hello.html.erb+):

A Greeting for You!

@@ -164,6 +164,8 @@ $ ./script/server => Booting WEBrick...
+WARNING: Make sure that you do not have any "tilde backup" files in +app/views/(controller)+, or else WEBrick will _not_ show the expected output. This seems to be a *bug* in Rails 2.3.0. + The URL will be +http://localhost:3000/greetings/hello+. I'll wait for you to be suitably impressed. INFO: With a normal, plain-old Rails application, your URLs will generally follow the pattern of http://(host)/(controller)/(action), and a URL like http://(host)/(controller) will hit the *index* action of that controller.