rails 4.0.0.rc1 → 4.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/guides/CHANGELOG.md +9 -2
- data/guides/assets/images/{challenge.png → getting_started/challenge.png} +0 -0
- data/guides/assets/images/getting_started/rails_welcome.png +0 -0
- data/guides/bug_report_templates/active_record_gem.rb +1 -1
- data/guides/code/getting_started/Gemfile.lock +1 -1
- data/guides/code/getting_started/config/environment.rb +2 -2
- data/guides/source/2_2_release_notes.md +1 -1
- data/guides/source/2_3_release_notes.md +2 -2
- data/guides/source/3_0_release_notes.md +3 -3
- data/guides/source/3_1_release_notes.md +1 -1
- data/guides/source/3_2_release_notes.md +3 -3
- data/guides/source/4_0_release_notes.md +4 -3
- data/guides/source/action_controller_overview.md +5 -5
- data/guides/source/action_mailer_basics.md +1 -1
- data/guides/source/active_record_querying.md +6 -1
- data/guides/source/active_record_validations.md +2 -1
- data/guides/source/active_support_core_extensions.md +9 -6
- data/guides/source/asset_pipeline.md +12 -14
- data/guides/source/caching_with_rails.md +2 -2
- data/guides/source/command_line.md +1 -1
- data/guides/source/configuring.md +1 -1
- data/guides/source/contributing_to_ruby_on_rails.md +2 -2
- data/guides/source/debugging_rails_applications.md +3 -1
- data/guides/source/development_dependencies_install.md +1 -1
- data/guides/source/getting_started.md +78 -179
- data/guides/source/i18n.md +1 -1
- data/guides/source/initialization.md +34 -36
- data/guides/source/layout.html.erb +2 -2
- data/guides/source/layouts_and_rendering.md +74 -68
- data/guides/source/migrations.md +19 -1
- data/guides/source/ruby_on_rails_guides_guidelines.md +4 -0
- data/guides/source/testing.md +25 -17
- data/guides/source/upgrading_ruby_on_rails.md +1 -1
- metadata +17 -17
- data/guides/assets/images/rails_welcome.png +0 -0
data/guides/source/i18n.md
CHANGED
@@ -258,7 +258,7 @@ match '/:locale' => 'dashboard#index'
|
|
258
258
|
|
259
259
|
Do take special care about the **order of your routes**, so this route declaration does not "eat" other ones. (You may want to add it directly before the `root :to` declaration.)
|
260
260
|
|
261
|
-
NOTE: Have a look at two plugins which simplify work with routes in this way: Sven Fuchs's [routing_filter](https://github.com/svenfuchs/routing-filter/tree/master and Raul Murciano's [translate_routes](https://github.com/raul/translate_routes/tree/master).
|
261
|
+
NOTE: Have a look at two plugins which simplify work with routes in this way: Sven Fuchs's [routing_filter](https://github.com/svenfuchs/routing-filter/tree/master) and Raul Murciano's [translate_routes](https://github.com/raul/translate_routes/tree/master).
|
262
262
|
|
263
263
|
### Setting the Locale from the Client Supplied Information
|
264
264
|
|
@@ -59,35 +59,33 @@ dependencies of the application. `config/boot.rb` sets
|
|
59
59
|
`ENV['BUNDLE_GEMFILE']` to the location of this file. If the Gemfile
|
60
60
|
exists, `bundler/setup` is then required.
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
*
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
73
|
-
*
|
74
|
-
*
|
75
|
-
*
|
76
|
-
*
|
77
|
-
*
|
78
|
-
*
|
79
|
-
*
|
80
|
-
* rack
|
81
|
-
* rack-
|
82
|
-
*
|
83
|
-
*
|
84
|
-
*
|
85
|
-
*
|
86
|
-
*
|
87
|
-
*
|
88
|
-
*
|
89
|
-
* treetop (1.4.9)
|
90
|
-
* tzinfo (0.3.23)
|
62
|
+
A standard Rails application depends on several gems, specifically:
|
63
|
+
|
64
|
+
* abstract
|
65
|
+
* actionmailer
|
66
|
+
* actionpack
|
67
|
+
* activemodel
|
68
|
+
* activerecord
|
69
|
+
* activesupport
|
70
|
+
* arel
|
71
|
+
* builder
|
72
|
+
* bundler
|
73
|
+
* erubis
|
74
|
+
* i18n
|
75
|
+
* mail
|
76
|
+
* mime-types
|
77
|
+
* polyglot
|
78
|
+
* rack
|
79
|
+
* rack-cache
|
80
|
+
* rack-mount
|
81
|
+
* rack-test
|
82
|
+
* rails
|
83
|
+
* railties
|
84
|
+
* rake
|
85
|
+
* sqlite3-ruby
|
86
|
+
* thor
|
87
|
+
* treetop
|
88
|
+
* tzinfo
|
91
89
|
|
92
90
|
### `rails/commands.rb`
|
93
91
|
|
@@ -131,7 +129,7 @@ when 'server'
|
|
131
129
|
end
|
132
130
|
```
|
133
131
|
|
134
|
-
This file will change into the root
|
132
|
+
This file will change into the Rails root directory (a path two directories up from `APP_PATH` which points at `config/application.rb`), but only if the `config.ru` file isn't found. This then requires `rails/commands/server` which sets up the `Rails::Server` class.
|
135
133
|
|
136
134
|
```ruby
|
137
135
|
require 'fileutils'
|
@@ -147,11 +145,11 @@ module Rails
|
|
147
145
|
### `actionpack/lib/action_dispatch.rb`
|
148
146
|
|
149
147
|
Action Dispatch is the routing component of the Rails framework.
|
150
|
-
It adds
|
148
|
+
It adds functionality like routing, session, and common middlewares.
|
151
149
|
|
152
150
|
### `rails/commands/server.rb`
|
153
151
|
|
154
|
-
The `Rails::Server` class is defined in this file
|
152
|
+
The `Rails::Server` class is defined in this file by inheriting from `Rack::Server`. When `Rails::Server.new` is called, this calls the `initialize` method in `rails/commands/server.rb`:
|
155
153
|
|
156
154
|
```ruby
|
157
155
|
def initialize(*)
|
@@ -441,14 +439,14 @@ inside each of those frameworks, but you're encouraged to try and
|
|
441
439
|
explore them on your own.
|
442
440
|
|
443
441
|
For now, just keep in mind that common functionality like Rails engines,
|
444
|
-
I18n and Rails configuration
|
442
|
+
I18n and Rails configuration are all being defined here.
|
445
443
|
|
446
444
|
### Back to `config/environment.rb`
|
447
445
|
|
448
446
|
When `config/application.rb` has finished loading Rails, and defined
|
449
|
-
|
450
|
-
where
|
451
|
-
`Blog`, here
|
447
|
+
the application namespace, we go back to `config/environment.rb`,
|
448
|
+
where the application is initialized. For example, if the application was called
|
449
|
+
`Blog`, here we would find `Blog::Application.initialize!`, which is
|
452
450
|
defined in `rails/application.rb`
|
453
451
|
|
454
452
|
### `railties/lib/rails/application.rb`
|
@@ -102,10 +102,10 @@
|
|
102
102
|
</p>
|
103
103
|
<p>
|
104
104
|
If you see any typos or factual errors you are confident to
|
105
|
-
patch, please clone <%= link_to 'docrails', 'https://github.com/
|
105
|
+
patch, please clone <%= link_to 'docrails', 'https://github.com/rails/docrails' %>
|
106
106
|
and push the change yourself. That branch of Rails has public write access.
|
107
107
|
Commits are still reviewed, but that happens after you've submitted your
|
108
|
-
contribution. <%= link_to 'docrails', 'https://github.com/
|
108
|
+
contribution. <%= link_to 'docrails', 'https://github.com/rails/docrails' %> is
|
109
109
|
cross-merged with master periodically.
|
110
110
|
</p>
|
111
111
|
<p>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Layouts and Rendering in Rails
|
2
2
|
==============================
|
3
3
|
|
4
|
-
This guide covers the basic layout features of Action Controller and Action View.
|
4
|
+
This guide covers the basic layout features of Action Controller and Action View.
|
5
5
|
|
6
6
|
After reading this guide, you will know:
|
7
7
|
|
@@ -283,8 +283,8 @@ Calls to the `render` method generally accept four options:
|
|
283
283
|
|
284
284
|
* `:content_type`
|
285
285
|
* `:layout`
|
286
|
-
* `:status`
|
287
286
|
* `:location`
|
287
|
+
* `:status`
|
288
288
|
|
289
289
|
##### The `:content_type` Option
|
290
290
|
|
@@ -310,80 +310,86 @@ You can also tell Rails to render with no layout at all:
|
|
310
310
|
render layout: false
|
311
311
|
```
|
312
312
|
|
313
|
-
##### The `:
|
313
|
+
##### The `:location` Option
|
314
314
|
|
315
|
-
|
315
|
+
You can use the `:location` option to set the HTTP `Location` header:
|
316
316
|
|
317
317
|
```ruby
|
318
|
-
render
|
319
|
-
render status: :forbidden
|
318
|
+
render xml: photo, location: photo_url(photo)
|
320
319
|
```
|
321
320
|
|
322
|
-
|
323
|
-
|
324
|
-
| HTTP Status Code | Symbol |
|
325
|
-
| ---------------- | -------------------------------- |
|
326
|
-
| 100 | :continue |
|
327
|
-
| 101 | :switching_protocols |
|
328
|
-
| 102 | :processing |
|
329
|
-
| 200 | :ok |
|
330
|
-
| 201 | :created |
|
331
|
-
| 202 | :accepted |
|
332
|
-
| 203 | :non_authoritative_information |
|
333
|
-
| 204 | :no_content |
|
334
|
-
| 205 | :reset_content |
|
335
|
-
| 206 | :partial_content |
|
336
|
-
| 207 | :multi_status |
|
337
|
-
| 226 | :im_used |
|
338
|
-
| 300 | :multiple_choices |
|
339
|
-
| 301 | :moved_permanently |
|
340
|
-
| 302 | :found |
|
341
|
-
| 303 | :see_other |
|
342
|
-
| 304 | :not_modified |
|
343
|
-
| 305 | :use_proxy |
|
344
|
-
| 306 | :reserved |
|
345
|
-
| 307 | :temporary_redirect |
|
346
|
-
| 400 | :bad_request |
|
347
|
-
| 401 | :unauthorized |
|
348
|
-
| 402 | :payment_required |
|
349
|
-
| 403 | :forbidden |
|
350
|
-
| 404 | :not_found |
|
351
|
-
| 405 | :method_not_allowed |
|
352
|
-
| 406 | :not_acceptable |
|
353
|
-
| 407 | :proxy_authentication_required |
|
354
|
-
| 408 | :request_timeout |
|
355
|
-
| 409 | :conflict |
|
356
|
-
| 410 | :gone |
|
357
|
-
| 411 | :length_required |
|
358
|
-
| 412 | :precondition_failed |
|
359
|
-
| 413 | :request_entity_too_large |
|
360
|
-
| 414 | :request_uri_too_long |
|
361
|
-
| 415 | :unsupported_media_type |
|
362
|
-
| 416 | :requested_range_not_satisfiable |
|
363
|
-
| 417 | :expectation_failed |
|
364
|
-
| 418 | :i'm_a_teapot |
|
365
|
-
| 422 | :unprocessable_entity |
|
366
|
-
| 423 | :locked |
|
367
|
-
| 424 | :failed_dependency |
|
368
|
-
| 426 | :upgrade_required |
|
369
|
-
| 500 | :internal_server_error |
|
370
|
-
| 501 | :not_implemented |
|
371
|
-
| 502 | :bad_gateway |
|
372
|
-
| 503 | :service_unavailable |
|
373
|
-
| 504 | :gateway_timeout |
|
374
|
-
| 505 | :http_version_not_supported |
|
375
|
-
| 506 | :variant_also_negotiates |
|
376
|
-
| 507 | :insufficient_storage |
|
377
|
-
| 510 | :not_extended |
|
378
|
-
|
379
|
-
##### The `:location` Option
|
321
|
+
##### The `:status` Option
|
380
322
|
|
381
|
-
You can use the `:
|
323
|
+
Rails will automatically generate a response with the correct HTTP status code (in most cases, this is `200 OK`). You can use the `:status` option to change this:
|
382
324
|
|
383
325
|
```ruby
|
384
|
-
render
|
326
|
+
render status: 500
|
327
|
+
render status: :forbidden
|
385
328
|
```
|
386
329
|
|
330
|
+
Rails understands both numeric status codes and the corresponding symbols shown below.
|
331
|
+
|
332
|
+
| Response Class | HTTP Status Code | Symbol |
|
333
|
+
| ------------------- | ---------------- | -------------------------------- |
|
334
|
+
| **Informational** | 100 | :continue |
|
335
|
+
| | 101 | :switching_protocols |
|
336
|
+
| | 102 | :processing |
|
337
|
+
| **Success** | 200 | :ok |
|
338
|
+
| | 201 | :created |
|
339
|
+
| | 202 | :accepted |
|
340
|
+
| | 203 | :non_authoritative_information |
|
341
|
+
| | 204 | :no_content |
|
342
|
+
| | 205 | :reset_content |
|
343
|
+
| | 206 | :partial_content |
|
344
|
+
| | 207 | :multi_status |
|
345
|
+
| | 208 | :already_reported |
|
346
|
+
| | 226 | :im_used |
|
347
|
+
| **Redirection** | 300 | :multiple_choices |
|
348
|
+
| | 301 | :moved_permanently |
|
349
|
+
| | 302 | :found |
|
350
|
+
| | 303 | :see_other |
|
351
|
+
| | 304 | :not_modified |
|
352
|
+
| | 305 | :use_proxy |
|
353
|
+
| | 306 | :reserved |
|
354
|
+
| | 307 | :temporary_redirect |
|
355
|
+
| | 308 | :permanent_redirect |
|
356
|
+
| **Client Error** | 400 | :bad_request |
|
357
|
+
| | 401 | :unauthorized |
|
358
|
+
| | 402 | :payment_required |
|
359
|
+
| | 403 | :forbidden |
|
360
|
+
| | 404 | :not_found |
|
361
|
+
| | 405 | :method_not_allowed |
|
362
|
+
| | 406 | :not_acceptable |
|
363
|
+
| | 407 | :proxy_authentication_required |
|
364
|
+
| | 408 | :request_timeout |
|
365
|
+
| | 409 | :conflict |
|
366
|
+
| | 410 | :gone |
|
367
|
+
| | 411 | :length_required |
|
368
|
+
| | 412 | :precondition_failed |
|
369
|
+
| | 413 | :request_entity_too_large |
|
370
|
+
| | 414 | :request_uri_too_long |
|
371
|
+
| | 415 | :unsupported_media_type |
|
372
|
+
| | 416 | :requested_range_not_satisfiable |
|
373
|
+
| | 417 | :expectation_failed |
|
374
|
+
| | 422 | :unprocessable_entity |
|
375
|
+
| | 423 | :locked |
|
376
|
+
| | 424 | :failed_dependency |
|
377
|
+
| | 426 | :upgrade_required |
|
378
|
+
| | 423 | :precondition_required |
|
379
|
+
| | 424 | :too_many_requests |
|
380
|
+
| | 426 | :request_header_fields_too_large |
|
381
|
+
| **Server Error** | 500 | :internal_server_error |
|
382
|
+
| | 501 | :not_implemented |
|
383
|
+
| | 502 | :bad_gateway |
|
384
|
+
| | 503 | :service_unavailable |
|
385
|
+
| | 504 | :gateway_timeout |
|
386
|
+
| | 505 | :http_version_not_supported |
|
387
|
+
| | 506 | :variant_also_negotiates |
|
388
|
+
| | 507 | :insufficient_storage |
|
389
|
+
| | 508 | :loop_detected |
|
390
|
+
| | 510 | :not_extended |
|
391
|
+
| | 511 | :network_authentication_required |
|
392
|
+
|
387
393
|
#### Finding Layouts
|
388
394
|
|
389
395
|
To find the current layout, Rails first looks for a file in `app/views/layouts` with the same base name as the controller. For example, rendering actions from the `PhotosController` class will use `app/views/layouts/photos.html.erb` (or `app/views/layouts/photos.builder`). If there is no such controller-specific layout, Rails will use `app/views/layouts/application.html.erb` or `app/views/layouts/application.builder`. If there is no `.erb` layout, Rails will use a `.builder` layout if one exists. Rails also provides several ways to more precisely assign specific layouts to individual controllers and actions.
|
@@ -633,7 +639,7 @@ This would detect that there are no books with the specified ID, populate the `@
|
|
633
639
|
|
634
640
|
### Using `head` To Build Header-Only Responses
|
635
641
|
|
636
|
-
The `head` method can be used to send responses with only headers to the browser. It provides a more obvious alternative to calling `render :nothing`. The `head` method
|
642
|
+
The `head` method can be used to send responses with only headers to the browser. It provides a more obvious alternative to calling `render :nothing`. The `head` method accepts a number or symbol (see [reference table](#the-status-option)) representing a HTTP status code. The options argument is interpreted as a hash of header names and values. For example, you can return only an error header:
|
637
643
|
|
638
644
|
```ruby
|
639
645
|
head :bad_request
|
@@ -709,7 +715,7 @@ There are three tag options available for the `auto_discovery_link_tag`:
|
|
709
715
|
|
710
716
|
* `:rel` specifies the `rel` value in the link. The default value is "alternate".
|
711
717
|
* `:type` specifies an explicit MIME type. Rails will generate an appropriate MIME type automatically.
|
712
|
-
* `:title` specifies the title of the link. The default value is the
|
718
|
+
* `:title` specifies the title of the link. The default value is the uppercase `:type` value, for example, "ATOM" or "RSS".
|
713
719
|
|
714
720
|
#### Linking to JavaScript Files with the `javascript_include_tag`
|
715
721
|
|
data/guides/source/migrations.md
CHANGED
@@ -150,7 +150,25 @@ class AddPartNumberToProducts < ActiveRecord::Migration
|
|
150
150
|
end
|
151
151
|
```
|
152
152
|
|
153
|
-
|
153
|
+
If you'd like to add an index on the new column, you can do that as well:
|
154
|
+
|
155
|
+
```bash
|
156
|
+
$ rails generate migration AddPartNumberToProducts part_number:string:index
|
157
|
+
```
|
158
|
+
|
159
|
+
will generate
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
class AddPartNumberToProducts < ActiveRecord::Migration
|
163
|
+
def change
|
164
|
+
add_column :products, :part_number, :string
|
165
|
+
add_index :products, :part_number
|
166
|
+
end
|
167
|
+
end
|
168
|
+
```
|
169
|
+
|
170
|
+
|
171
|
+
Similarly, you can generate a migration to remove a column from the command line:
|
154
172
|
|
155
173
|
```bash
|
156
174
|
$ rails generate migration RemovePartNumberFromProducts part_number:string
|
@@ -63,6 +63,10 @@ Those guidelines apply also to guides.
|
|
63
63
|
HTML Guides
|
64
64
|
-----------
|
65
65
|
|
66
|
+
Before generating the guides, make sure that you have the latest version of Bundler installed on your system. As of this writing, you must install Bundler 1.3.5 on your device.
|
67
|
+
|
68
|
+
To install the latest version of Bundler, simply run the `gem install bundler` command
|
69
|
+
|
66
70
|
### Generation
|
67
71
|
|
68
72
|
To generate all the guides, just `cd` into the `guides` directory, run `bundle install` and execute:
|
data/guides/source/testing.md
CHANGED
@@ -85,8 +85,8 @@ ERB allows you to embed Ruby code within templates. The YAML fixture format is p
|
|
85
85
|
```erb
|
86
86
|
<% 1000.times do |n| %>
|
87
87
|
user_<%= n %>:
|
88
|
-
username: <%= "user
|
89
|
-
email: <%= "user
|
88
|
+
username: <%= "user#{n}" %>
|
89
|
+
email: <%= "user#{n}@example.com" %>
|
90
90
|
<% end %>
|
91
91
|
```
|
92
92
|
|
@@ -159,9 +159,10 @@ class PostTest < ActiveSupport::TestCase
|
|
159
159
|
|
160
160
|
The `PostTest` class defines a _test case_ because it inherits from `ActiveSupport::TestCase`. `PostTest` thus has all the methods available from `ActiveSupport::TestCase`. You'll see those methods a little later in this guide.
|
161
161
|
|
162
|
-
Any method defined within a
|
162
|
+
Any method defined within a class inherited from `MiniTest::Unit::TestCase`
|
163
|
+
(which is the superclass of `ActiveSupport::TestCase`) that begins with `test` (case sensitive) is simply called a test. So, `test_password`, `test_valid_password` and `testValidPassword` all are legal test names and are run automatically when the test case is run.
|
163
164
|
|
164
|
-
Rails adds a `test` method that takes a test name and a block. It generates a normal `
|
165
|
+
Rails adds a `test` method that takes a test name and a block. It generates a normal `MiniTest::Unit` test with method names prefixed with `test_`. So,
|
165
166
|
|
166
167
|
```ruby
|
167
168
|
test "the truth" do
|
@@ -346,31 +347,38 @@ NOTE: The execution of each test method stops as soon as any error or an asserti
|
|
346
347
|
|
347
348
|
Ideally, you would like to include a test for everything which could possibly break. It's a good practice to have at least one test for each of your validations and at least one test for every method in your model.
|
348
349
|
|
349
|
-
### Assertions
|
350
|
+
### Available Assertions
|
350
351
|
|
351
352
|
By now you've caught a glimpse of some of the assertions that are available. Assertions are the worker bees of testing. They are the ones that actually perform the checks to ensure that things are going as planned.
|
352
353
|
|
353
|
-
There are a bunch of different types of assertions you can use.
|
354
|
+
There are a bunch of different types of assertions you can use.
|
355
|
+
Here's an extract of the assertions you can use with `minitest`, the default testing library used by Rails. The `[msg]` parameter is an optional string message you can specify to make your test failure messages clearer. It's not required.
|
354
356
|
|
355
357
|
| Assertion | Purpose |
|
356
358
|
| ---------------------------------------------------------------- | ------- |
|
357
|
-
| `assert(
|
359
|
+
| `assert( test, [msg] )` | Ensures that `test` is true.|
|
360
|
+
| `refute( test, [msg] )` | Ensures that `test` is false.|
|
358
361
|
| `assert_equal( expected, actual, [msg] )` | Ensures that `expected == actual` is true.|
|
359
|
-
| `
|
362
|
+
| `refute_equal( expected, actual, [msg] )` | Ensures that `expected != actual` is true.|
|
360
363
|
| `assert_same( expected, actual, [msg] )` | Ensures that `expected.equal?(actual)` is true.|
|
361
|
-
| `
|
364
|
+
| `refute_same( expected, actual, [msg] )` | Ensures that `expected.equal?(actual)` is false.|
|
362
365
|
| `assert_nil( obj, [msg] )` | Ensures that `obj.nil?` is true.|
|
363
|
-
| `
|
366
|
+
| `refute_nil( obj, [msg] )` | Ensures that `obj.nil?` is false.|
|
364
367
|
| `assert_match( regexp, string, [msg] )` | Ensures that a string matches the regular expression.|
|
365
|
-
| `
|
366
|
-
| `assert_in_delta( expecting, actual, delta, [msg] )`
|
368
|
+
| `refute_match( regexp, string, [msg] )` | Ensures that a string doesn't match the regular expression.|
|
369
|
+
| `assert_in_delta( expecting, actual, [delta], [msg] )` | Ensures that the numbers `expected` and `actual` are within `delta` of each other.|
|
370
|
+
| `refute_in_delta( expecting, actual, [delta], [msg] )` | Ensures that the numbers `expected` and `actual` are not within `delta` of each other.|
|
367
371
|
| `assert_throws( symbol, [msg] ) { block }` | Ensures that the given block throws the symbol.|
|
368
|
-
| `
|
372
|
+
| `assert_raises( exception1, exception2, ... ) { block }` | Ensures that the given block raises one of the given exceptions.|
|
369
373
|
| `assert_nothing_raised( exception1, exception2, ... ) { block }` | Ensures that the given block doesn't raise one of the given exceptions.|
|
370
|
-
| `assert_instance_of( class, obj, [msg] )` | Ensures that `obj` is of
|
374
|
+
| `assert_instance_of( class, obj, [msg] )` | Ensures that `obj` is an instance of `class`.|
|
375
|
+
| `refute_instance_of( class, obj, [msg] )` | Ensures that `obj` is not an instance of `class`.|
|
371
376
|
| `assert_kind_of( class, obj, [msg] )` | Ensures that `obj` is or descends from `class`.|
|
372
|
-
| `
|
373
|
-
| `
|
377
|
+
| `refute_kind_of( class, obj, [msg] )` | Ensures that `obj` is not an instance of `class` and is not descending from it.|
|
378
|
+
| `assert_respond_to( obj, symbol, [msg] )` | Ensures that `obj` responds to `symbol`.|
|
379
|
+
| `refute_respond_to( obj, symbol, [msg] )` | Ensures that `obj` does not respond to `symbol`.|
|
380
|
+
| `assert_operator( obj1, operator, [obj2], [msg] )` | Ensures that `obj1.operator(obj2)` is true.|
|
381
|
+
| `refute_operator( obj1, operator, [obj2], [msg] )` | Ensures that `obj1.operator(obj2)` is false.|
|
374
382
|
| `assert_send( array, [msg] )` | Ensures that executing the method listed in `array[1]` on the object in `array[0]` with the parameters of `array[2 and up]` is true. This one is weird eh?|
|
375
383
|
| `flunk( [msg] )` | Ensures failure. This is useful to explicitly mark a test that isn't finished yet.|
|
376
384
|
|
@@ -475,7 +483,7 @@ NOTE: Functional tests do not verify whether the specified request type should b
|
|
475
483
|
|
476
484
|
### The Four Hashes of the Apocalypse
|
477
485
|
|
478
|
-
After a request has been made
|
486
|
+
After a request has been made using one of the 6 methods (`get`, `post`, etc.) and processed, you will have 4 Hash objects ready for use:
|
479
487
|
|
480
488
|
* `assigns` - Any objects that are stored as instance variables in actions for use in views.
|
481
489
|
* `cookies` - Any cookies that are set.
|
@@ -118,7 +118,7 @@ Please read [Pull Request #9978](https://github.com/rails/rails/pull/9978) for d
|
|
118
118
|
|
119
119
|
* Rails 4.0 changes the default memcached client from `memcache-client` to `dalli`. To upgrade, simply add `gem 'dalli'` to your `Gemfile`.
|
120
120
|
|
121
|
-
* Rails 4.0 deprecates the `dom_id` and `dom_class` methods. You will need to include the `ActionView::RecordIdentifier` module in controllers requiring this feature.
|
121
|
+
* Rails 4.0 deprecates the `dom_id` and `dom_class` methods in controllers (they are fine in views). You will need to include the `ActionView::RecordIdentifier` module in controllers requiring this feature.
|
122
122
|
|
123
123
|
* Rails 4.0 changed how `assert_generates`, `assert_recognizes`, and `assert_routing` work. Now all these assertions raise `Assertion` instead of `ActionController::RoutingError`.
|
124
124
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.0.0.
|
19
|
+
version: 4.0.0.rc2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.0.0.
|
26
|
+
version: 4.0.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.0.0.
|
33
|
+
version: 4.0.0.rc2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.0.0.
|
40
|
+
version: 4.0.0.rc2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activerecord
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.0.0.
|
47
|
+
version: 4.0.0.rc2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.0.0.
|
54
|
+
version: 4.0.0.rc2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: actionmailer
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 4.0.0.
|
61
|
+
version: 4.0.0.rc2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.0.0.
|
68
|
+
version: 4.0.0.rc2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: railties
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 4.0.0.
|
75
|
+
version: 4.0.0.rc2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 4.0.0.
|
82
|
+
version: 4.0.0.rc2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.0.0
|
109
|
+
version: 2.0.0
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - ~>
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 2.0.0
|
116
|
+
version: 2.0.0
|
117
117
|
description: Ruby on Rails is a full-stack web framework optimized for programmer
|
118
118
|
happiness and sustainable productivity. It encourages beautiful code by favoring
|
119
119
|
convention over configuration.
|
@@ -126,7 +126,6 @@ files:
|
|
126
126
|
- guides/assets/images/belongs_to.png
|
127
127
|
- guides/assets/images/book_icon.gif
|
128
128
|
- guides/assets/images/bullet.gif
|
129
|
-
- guides/assets/images/challenge.png
|
130
129
|
- guides/assets/images/chapters_icon.gif
|
131
130
|
- guides/assets/images/check_bullet.gif
|
132
131
|
- guides/assets/images/credits_pic_blank.gif
|
@@ -136,12 +135,14 @@ files:
|
|
136
135
|
- guides/assets/images/feature_tile.gif
|
137
136
|
- guides/assets/images/footer_tile.gif
|
138
137
|
- guides/assets/images/fxn.png
|
138
|
+
- guides/assets/images/getting_started/challenge.png
|
139
139
|
- guides/assets/images/getting_started/confirm_dialog.png
|
140
140
|
- guides/assets/images/getting_started/forbidden_attributes_for_new_post.png
|
141
141
|
- guides/assets/images/getting_started/form_with_errors.png
|
142
142
|
- guides/assets/images/getting_started/index_action_with_edit_link.png
|
143
143
|
- guides/assets/images/getting_started/new_post.png
|
144
144
|
- guides/assets/images/getting_started/post_with_comments.png
|
145
|
+
- guides/assets/images/getting_started/rails_welcome.png
|
145
146
|
- guides/assets/images/getting_started/routing_error_no_controller.png
|
146
147
|
- guides/assets/images/getting_started/routing_error_no_route_matches.png
|
147
148
|
- guides/assets/images/getting_started/show_action_for_posts.png
|
@@ -198,7 +199,6 @@ files:
|
|
198
199
|
- guides/assets/images/rails_guides_kindle_cover.jpg
|
199
200
|
- guides/assets/images/rails_guides_logo.gif
|
200
201
|
- guides/assets/images/rails_logo_remix.gif
|
201
|
-
- guides/assets/images/rails_welcome.png
|
202
202
|
- guides/assets/images/session_fixation.png
|
203
203
|
- guides/assets/images/tab_grey.gif
|
204
204
|
- guides/assets/images/tab_info.gif
|
@@ -422,7 +422,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
422
422
|
version: 1.8.11
|
423
423
|
requirements: []
|
424
424
|
rubyforge_project:
|
425
|
-
rubygems_version: 2.0.
|
425
|
+
rubygems_version: 2.0.2
|
426
426
|
signing_key:
|
427
427
|
specification_version: 4
|
428
428
|
summary: Full-stack web application framework.
|