aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_coder@freenet.de>2009-02-14 15:43:55 +0100
committerAndreas Scherer <andreas_coder@freenet.de>2009-02-14 15:43:55 +0100
commit8eb7ad21ccc8dcd8ff312009070f6792929c6276 (patch)
tree9b4ccdb26c59d244a56f526c7570da41d2ba34f5 /railties/guides/source
parent11b15d2de21767d19eabfb201c175974585e1626 (diff)
downloadrails-8eb7ad21ccc8dcd8ff312009070f6792929c6276.tar.gz
rails-8eb7ad21ccc8dcd8ff312009070f6792929c6276.tar.bz2
rails-8eb7ad21ccc8dcd8ff312009070f6792929c6276.zip
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.
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/command_line.textile12
1 files 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.
<shell>
-$ ./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+):
<ruby>
-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
</ruby>
-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+):
<html>
<h1>A Greeting for You!</h1>
@@ -164,6 +164,8 @@ $ ./script/server
=> Booting WEBrick...
</shell>
+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.