From 56152d8f60963a3d862f335144a33782723ade83 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 18 Jan 2009 00:18:02 +0000 Subject: Regenerate guides --- railties/doc/guides/html/command_line.html | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'railties/doc/guides/html/command_line.html') diff --git a/railties/doc/guides/html/command_line.html b/railties/doc/guides/html/command_line.html index 7f925bc10a..226a68e105 100644 --- a/railties/doc/guides/html/command_line.html +++ b/railties/doc/guides/html/command_line.html @@ -135,7 +135,7 @@ rails
-
@@ -171,7 +171,7 @@ http://www.gnu.org/software/src-highlite -->

Here we’ll flex our server command, which without any prodding of any kind will run our new shiny Rails app:

-
@@ -188,7 +188,7 @@ $ ./script/server

1.3. generate

The generate command uses templates to create a whole lot of things. You can always find out what’s available by running generate by itself. Let’s do that:

-
@@ -222,7 +222,7 @@ Installed Generators
-
@@ -251,7 +251,7 @@ Modules Example: Test: test/functional/admin/credit_card_controller_test.rb

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.

-
@@ -267,7 +267,7 @@ http://www.gnu.org/software/src-highlite -->

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):

-
@@ -279,7 +279,7 @@ http://www.gnu.org/software/src-highlite --> end

Then the view, to display our nice message (in app/views/greeting/hello.html.erb):

-
@@ -287,7 +287,7 @@ http://www.gnu.org/software/src-highlite --> <p><%= @message %></p>

Deal. Go check it out in your browser. Fire up your server. Remember? ./script/server at the root of your Rails application should do it.

-
@@ -304,7 +304,7 @@ http://www.gnu.org/software/src-highlite -->

"What about data, though?", you ask over a cup of coffee. Rails comes with a generator for data models too. Can you guess its generator name?

-
@@ -328,7 +328,7 @@ Examples:

But instead of generating a model directly (which we’ll be doing later), let’s set up a scaffold. A scaffold in Rails is a full set of model, database migration for that model, controller to manipulate it, views to view and manipulate the data, and a test suite for each of the above.

Let’s set up a simple resource called "HighScore" that will keep track of our highest score on video games we play.

-
@@ -371,7 +371,7 @@ dependency model
-
@@ -400,7 +400,7 @@ http://www.gnu.org/software/src-highlite -->

Let’s say you’re creating a website for a client who wants a small accounting system. Every event having to do with money must be logged, and must never be deleted. Wouldn’t it be great if we could override the behavior of a model to never actually take its record out of the database, but instead, just set a field?

There is such a thing! The plugin we’re installing is called "acts_as_paranoid", and it lets models implement a "deleted_at" column that gets set when you call destroy. Later, when calling find, the plugin will tack on a database check to filter out "deleted" things.

-
@@ -412,7 +412,7 @@ http://www.gnu.org/software/src-highlite -->

1.7. runner

runner runs Ruby code in the context of Rails non-interactively. For instance:

-
@@ -420,7 +420,7 @@ http://www.gnu.org/software/src-highlite -->

1.8. destroy

Think of destroy as the opposite of generate. It’ll figure out what generate did, and undo it. Believe you-me, the creation of this tutorial used this command many times!

-
@@ -449,7 +449,7 @@ $ ./script/destroy model Oops

1.9. about

Check it: Version numbers for Ruby, RubyGems, Rails, the Rails subcomponents, your application’s folder, the current Rails environment name, your app’s database adapter, and schema version! about is useful when you need to ask help, check if a security patch might affect you, or when you need some stats for an existing Rails installation.

-
-- cgit v1.2.3