Browse files

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.
  • Loading branch information...
1 parent 11b15d2 commit 8eb7ad21ccc8dcd8ff312009070f6792929c6276 Andreas Scherer committed Feb 14, 2009
Showing with 7 additions and 5 deletions.
  1. +7 −5 railties/guides/source/command_line.textile
12 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,18 +139,18 @@ $ ./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!"
-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+):
<h1>A Greeting for You!</h1>
@@ -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.

0 comments on commit 8eb7ad2

Please sign in to comment.