diff options
author | Tore Darell <toredarell@gmail.com> | 2008-11-04 23:20:21 +0100 |
---|---|---|
committer | Tore Darell <toredarell@gmail.com> | 2008-11-04 23:20:21 +0100 |
commit | 6d12daf5a715e44581778973c1d47ae5da43081f (patch) | |
tree | 1cab28b3eacb4802663172d77f7ea569a9624e8b /railties/doc/guides/source | |
parent | 5c1f4aa401c4afcecf8b2a0d25b77bdbb641b878 (diff) | |
parent | e884f2b8325cbca9ca829d93b5b11aad1c9f7346 (diff) | |
download | rails-6d12daf5a715e44581778973c1d47ae5da43081f.tar.gz rails-6d12daf5a715e44581778973c1d47ae5da43081f.tar.bz2 rails-6d12daf5a715e44581778973c1d47ae5da43081f.zip |
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'railties/doc/guides/source')
4 files changed, 2 insertions, 22 deletions
diff --git a/railties/doc/guides/source/2_2_release_notes.txt b/railties/doc/guides/source/2_2_release_notes.txt index 2e9e9b8aa1..715648b95e 100644 --- a/railties/doc/guides/source/2_2_release_notes.txt +++ b/railties/doc/guides/source/2_2_release_notes.txt @@ -44,7 +44,7 @@ The internal documentation of Rails, in the form of code comments, has been impr All told, the Guides provide tens of thousands of words of guidance for beginning and intermediate Rails developers. -If you want to these generate guides locally, inside your application: +If you want to generate these guides locally, inside your application: [source, ruby] ------------------------------------------------------- diff --git a/railties/doc/guides/source/debugging_rails_applications.txt b/railties/doc/guides/source/debugging_rails_applications.txt index b67f4be126..b45473fc14 100644 --- a/railties/doc/guides/source/debugging_rails_applications.txt +++ b/railties/doc/guides/source/debugging_rails_applications.txt @@ -31,7 +31,6 @@ The `debug` helper will return a <pre>-tag that renders the object using the YAM You'll see something like this: -[source, log] ---------------------------------------------------------------------------- --- !ruby/object:Post attributes: @@ -64,7 +63,6 @@ The `to_yaml` method converts the method to YAML format leaving it more readable As a result of this, you will have something like this in your view: -[source, log] ---------------------------------------------------------------------------- --- !ruby/object:Post attributes: @@ -94,7 +92,6 @@ Another useful method for displaying object values is `inspect`, especially when Will be rendered as follows: -[source, log] ---------------------------------------------------------------------------- [1, 2, 3, 4, 5] @@ -204,7 +201,6 @@ end Here's an example of the log generated by this method: -[source, log] ---------------------------------------------------------------------------- Processing PostsController#create (for 127.0.0.1 at 2008-09-08 11:52:54) [POST] Session ID: BAh7BzoMY3NyZl9pZCIlMDY5MWU1M2I1ZDRjODBlMzkyMWI1OTg2NWQyNzViZjYiCmZsYXNoSUM6J0FjdGl @@ -258,7 +254,6 @@ end If you see the message in the console or logs: -[source, log] ---------------------------------------------------------------------------- ***** Debugger requested, but was not available: Start server with --debugger to enable ***** ---------------------------------------------------------------------------- @@ -631,7 +626,6 @@ You can include any number of these configuration lines inside a `.rdebugrc` fil Here's a good start for an `.rdebugrc`: -[source, log] ---------------------------------------------------------------------------- set autolist set forcestep @@ -671,7 +665,6 @@ RAILS_ENV=production BLEAK_HOUSE=1 ruby-bleak-house ./script/server Make sure to run a couple hundred requests to get better data samples, then press `CTRL-C`. The server will stop and Bleak House will produce a dumpfile in `/tmp`: -[source, log] ---------------------------------------------------------------------------- ** BleakHouse: working... ** BleakHouse: complete @@ -680,7 +673,6 @@ Make sure to run a couple hundred requests to get better data samples, then pres To analyze it, just run the listed command. The top 20 leakiest lines will be listed: -[source, log] ---------------------------------------------------------------------------- 191691 total objects Final heap size 191691 filled, 220961 free diff --git a/railties/doc/guides/source/finders.txt b/railties/doc/guides/source/finders.txt index 945b527e1d..24d078f9e4 100644 --- a/railties/doc/guides/source/finders.txt +++ b/railties/doc/guides/source/finders.txt @@ -68,7 +68,6 @@ If you wanted to find clients with id 1 or 2, you call +Client.find([1,2])+ or + SELECT * FROM +clients+ WHERE (+clients+.+id+ IN (1,2)) ------------------------------------------------------- -[source,txt] ------------------------------------------------------- >> Client.find(1,2) => [#<Client id: 1, name: => "Ryan", locked: false, orders_count: 2, @@ -81,7 +80,6 @@ Note that if you pass in a list of numbers that the result will be returned as a If you wanted to find the first client you would simply type +Client.first+ and that would find the first client created in your clients table: -[source,txt] ------------------------------------------------------- >> Client.first => #<Client id: 1, name: => "Ryan", locked: false, orders_count: 2, @@ -99,7 +97,6 @@ Indicating the query that Rails has performed on your database. To find the last client you would simply type +Client.find(:last)+ and that would find the last client created in your clients table: -[source,txt] ------------------------------------------------------- >> Client.find(:last) => #<Client id: 2, name: => "Michael", locked: false, orders_count: 3, @@ -113,7 +110,6 @@ SELECT * FROM clients ORDER BY clients.id DESC LIMIT 1 To find all the clients you would simply type +Client.all+ and that would find all the clients in your clients table: -[source,txt] ------------------------------------------------------- >> Client.all => [#<Client id: 1, name: => "Ryan", locked: false, orders_count: 2, @@ -192,7 +188,6 @@ SELECT * FROM +users+ WHERE (created_at IN This could possibly cause your database server to raise an unexpected error, for example MySQL will throw back this error: -[source, txt] ------------------------------------------------------- Got a packet bigger than 'max_allowed_packet' bytes: _query_ ------------------------------------------------------- diff --git a/railties/doc/guides/source/testing_rails_applications.txt b/railties/doc/guides/source/testing_rails_applications.txt index dc7635eff9..31b6fc2cfa 100644 --- a/railties/doc/guides/source/testing_rails_applications.txt +++ b/railties/doc/guides/source/testing_rails_applications.txt @@ -89,7 +89,6 @@ Fixtures can also be described using the all-too-familiar comma-separated value A CSV fixture looks like this: -[source, log] -------------------------------------------------------------- id, username, password, stretchable, comments 1, sclaus, ihatekids, false, I like to say ""Ho! Ho! Ho!"" @@ -184,7 +183,6 @@ In Rails, unit tests are what you write to test your models. When you create a model using +script/generate+, among other things it creates a test stub in the +test/unit+ folder, as well as a fixture for the model: -[source, log] ------------------------------------------------------- $ script/generate model Post ... @@ -266,7 +264,6 @@ This will run all the test methods from the test case. You can also run a particular test method from the test case by using the +-n+ switch with the +test method name+. -[source, log] ------------------------------------------------------- $ ruby unit/post_test.rb -n test_truth @@ -292,7 +289,6 @@ end If you haven't added any data to the test fixture for posts, this test will fail. You can see this by running it: -[source, log] ------------------------------------------------------- $ ruby unit/post_test.rb Loaded suite unit/post_test @@ -322,7 +318,6 @@ end Running this test shows the friendlier assertion message: -[source, log] ------------------------------------------------------- $ ruby unit/post_test.rb Loaded suite unit/post_test @@ -354,7 +349,6 @@ end Now you can see even more output in the console from running the tests: -[source, log] ------------------------------------------------------- $ ruby unit/post_test.rb Loaded suite unit/post_test @@ -519,7 +513,7 @@ Another example: Calling the +:view+ action, passing an +id+ of 12 as the +param get(:view, {'id' => '12'}, nil, {'message' => 'booya!'}) -------------------------------------------------- -=== Available Request Types for Functional Tests=== +=== Available Request Types for Functional Tests === If you're familiar with the HTTP protocol, you'll know that +get+ is a type of request. There are 5 request types supported in Rails functional tests: @@ -817,7 +811,6 @@ In this test, +@expected+ is an instance of +TMail::Mail+ that you can use in yo Here's the content of the +invite+ fixture: -[source, log] ------------------------------------------------- Hi friend@example.com, |