rails 4.0.13 → 4.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -17
- data/guides/CHANGELOG.md +68 -34
- data/guides/assets/images/edge_badge.png +0 -0
- data/guides/assets/images/feature_tile.gif +0 -0
- data/guides/assets/images/footer_tile.gif +0 -0
- data/guides/assets/images/fxn.png +0 -0
- data/guides/assets/images/getting_started/article_with_comments.png +0 -0
- data/guides/assets/images/getting_started/challenge.png +0 -0
- data/guides/assets/images/getting_started/confirm_dialog.png +0 -0
- data/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
- data/guides/assets/images/getting_started/form_with_errors.png +0 -0
- data/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
- data/guides/assets/images/getting_started/new_article.png +0 -0
- data/guides/assets/images/getting_started/rails_welcome.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
- data/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
- data/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
- data/guides/assets/images/header_tile.gif +0 -0
- data/guides/assets/images/icons/README +1 -1
- data/guides/assets/images/icons/callouts/11.png +0 -0
- data/guides/assets/images/icons/callouts/12.png +0 -0
- data/guides/assets/images/icons/callouts/13.png +0 -0
- data/guides/assets/images/icons/callouts/15.png +0 -0
- data/guides/assets/images/icons/caution.png +0 -0
- data/guides/assets/images/icons/example.png +0 -0
- data/guides/assets/images/radar.png +0 -0
- data/guides/assets/images/rails4_features.png +0 -0
- data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/guides/assets/images/vijaydev.jpg +0 -0
- data/guides/assets/javascripts/guides.js +30 -34
- data/guides/assets/stylesheets/main.css +2 -1
- data/guides/assets/stylesheets/print.css +1 -1
- data/guides/bug_report_templates/action_controller_gem.rb +9 -4
- data/guides/bug_report_templates/action_controller_master.rb +4 -2
- data/guides/bug_report_templates/active_record_gem.rb +5 -2
- data/guides/bug_report_templates/active_record_master.rb +2 -1
- data/guides/bug_report_templates/generic_gem.rb +15 -0
- data/guides/bug_report_templates/generic_master.rb +26 -0
- data/guides/code/getting_started/Gemfile +21 -24
- data/guides/code/getting_started/Gemfile.lock +78 -73
- data/guides/code/getting_started/Rakefile +1 -1
- data/guides/code/getting_started/app/assets/javascripts/application.js +1 -2
- data/guides/code/getting_started/app/views/layouts/application.html.erb +2 -2
- data/guides/code/getting_started/config/environment.rb +1 -1
- data/guides/code/getting_started/config/environments/development.rb +2 -2
- data/guides/code/getting_started/config/environments/production.rb +3 -3
- data/guides/code/getting_started/config/environments/test.rb +2 -2
- data/guides/code/getting_started/config/initializers/secret_token.rb +1 -1
- data/guides/code/getting_started/config/initializers/session_store.rb +1 -1
- data/guides/code/getting_started/config/routes.rb +1 -1
- data/guides/code/getting_started/config.ru +1 -1
- data/guides/code/getting_started/public/404.html +2 -0
- data/guides/code/getting_started/public/422.html +2 -0
- data/guides/code/getting_started/public/500.html +2 -0
- data/guides/code/getting_started/test/test_helper.rb +0 -3
- data/guides/rails_guides/helpers.rb +3 -1
- data/guides/source/2_2_release_notes.md +2 -2
- data/guides/source/2_3_release_notes.md +8 -8
- data/guides/source/3_0_release_notes.md +2 -3
- data/guides/source/3_1_release_notes.md +2 -2
- data/guides/source/3_2_release_notes.md +12 -12
- data/guides/source/4_0_release_notes.md +79 -46
- data/guides/source/4_1_release_notes.md +731 -0
- data/guides/source/_welcome.html.erb +5 -2
- data/guides/source/action_controller_overview.md +189 -40
- data/guides/source/action_mailer_basics.md +27 -27
- data/guides/source/action_view_overview.md +131 -20
- data/guides/source/active_model_basics.md +6 -6
- data/guides/source/active_record_basics.md +15 -15
- data/guides/source/active_record_callbacks.md +18 -16
- data/guides/source/active_record_querying.md +93 -51
- data/guides/source/active_record_validations.md +26 -24
- data/guides/source/active_support_core_extensions.md +72 -118
- data/guides/source/active_support_instrumentation.md +13 -4
- data/guides/source/api_documentation_guidelines.md +104 -6
- data/guides/source/asset_pipeline.md +573 -244
- data/guides/source/association_basics.md +94 -22
- data/guides/source/caching_with_rails.md +15 -6
- data/guides/source/command_line.md +55 -46
- data/guides/source/configuring.md +248 -52
- data/guides/source/contributing_to_ruby_on_rails.md +18 -17
- data/guides/source/credits.html.erb +2 -2
- data/guides/source/debugging_rails_applications.md +39 -8
- data/guides/source/development_dependencies_install.md +91 -8
- data/guides/source/documents.yaml +4 -0
- data/guides/source/engines.md +678 -232
- data/guides/source/form_helpers.md +53 -35
- data/guides/source/generators.md +19 -15
- data/guides/source/getting_started.md +758 -497
- data/guides/source/i18n.md +64 -28
- data/guides/source/index.html.erb +1 -1
- data/guides/source/initialization.md +155 -58
- data/guides/source/kindle/toc.html.erb +1 -1
- data/guides/source/layout.html.erb +2 -2
- data/guides/source/layouts_and_rendering.md +59 -26
- data/guides/source/maintenance_policy.md +3 -3
- data/guides/source/migrations.md +101 -62
- data/guides/source/nested_model_forms.md +3 -3
- data/guides/source/plugins.md +34 -31
- data/guides/source/rails_application_templates.md +27 -8
- data/guides/source/rails_on_rack.md +41 -58
- data/guides/source/routing.md +115 -104
- data/guides/source/ruby_on_rails_guides_guidelines.md +2 -2
- data/guides/source/security.md +81 -36
- data/guides/source/testing.md +56 -79
- data/guides/source/upgrading_ruby_on_rails.md +531 -21
- data/guides/source/working_with_javascript_in_rails.md +19 -11
- metadata +51 -23
- data/guides/assets/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
- data/guides/assets/images/getting_started/new_post.png +0 -0
- data/guides/assets/images/getting_started/post_with_comments.png +0 -0
- data/guides/assets/images/getting_started/show_action_for_posts.png +0 -0
- data/guides/assets/images/getting_started/template_is_missing_posts_new.png +0 -0
- data/guides/assets/images/getting_started/undefined_method_post_path.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_create_for_posts.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_new_for_posts.png +0 -0
- data/guides/assets/images/jaimeiniesta.jpg +0 -0
- data/guides/source/kindle/KINDLE.md +0 -26
@@ -1,120 +1,125 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (4.
|
5
|
-
actionpack (= 4.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
actionmailer (4.1.1)
|
5
|
+
actionpack (= 4.1.1)
|
6
|
+
actionview (= 4.1.1)
|
7
|
+
mail (~> 2.5.4)
|
8
|
+
actionpack (4.1.1)
|
9
|
+
actionview (= 4.1.1)
|
10
|
+
activesupport (= 4.1.1)
|
11
11
|
rack (~> 1.5.2)
|
12
12
|
rack-test (~> 0.6.2)
|
13
|
-
|
14
|
-
activesupport (= 4.
|
15
|
-
builder (~> 3.1
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
13
|
+
actionview (4.1.1)
|
14
|
+
activesupport (= 4.1.1)
|
15
|
+
builder (~> 3.1)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
activemodel (4.1.1)
|
18
|
+
activesupport (= 4.1.1)
|
19
|
+
builder (~> 3.1)
|
20
|
+
activerecord (4.1.1)
|
21
|
+
activemodel (= 4.1.1)
|
22
|
+
activesupport (= 4.1.1)
|
23
|
+
arel (~> 5.0.0)
|
24
|
+
activesupport (4.1.1)
|
25
|
+
i18n (~> 0.6, >= 0.6.9)
|
26
|
+
json (~> 1.7, >= 1.7.7)
|
27
|
+
minitest (~> 5.1)
|
26
28
|
thread_safe (~> 0.1)
|
27
|
-
tzinfo (~>
|
28
|
-
arel (
|
29
|
-
|
30
|
-
|
31
|
-
coffee-rails (4.0.0)
|
29
|
+
tzinfo (~> 1.1)
|
30
|
+
arel (5.0.1.20140414130214)
|
31
|
+
builder (3.2.2)
|
32
|
+
coffee-rails (4.0.1)
|
32
33
|
coffee-script (>= 2.2.0)
|
33
|
-
railties (>= 4.0.0
|
34
|
+
railties (>= 4.0.0, < 5.0)
|
34
35
|
coffee-script (2.2.0)
|
35
36
|
coffee-script-source
|
36
37
|
execjs
|
37
38
|
coffee-script-source (1.6.3)
|
38
39
|
erubis (2.7.0)
|
39
|
-
execjs (
|
40
|
-
multi_json (~> 1.0)
|
40
|
+
execjs (2.0.2)
|
41
41
|
hike (1.2.3)
|
42
|
-
i18n (0.6.
|
43
|
-
jbuilder (
|
42
|
+
i18n (0.6.9)
|
43
|
+
jbuilder (2.0.2)
|
44
44
|
activesupport (>= 3.0.0)
|
45
45
|
multi_json (>= 1.2.0)
|
46
|
-
jquery-rails (3.0.
|
46
|
+
jquery-rails (3.0.4)
|
47
47
|
railties (>= 3.0, < 5.0)
|
48
48
|
thor (>= 0.14, < 2.0)
|
49
|
-
json (1.8.
|
49
|
+
json (1.8.1)
|
50
50
|
mail (2.5.4)
|
51
51
|
mime-types (~> 1.16)
|
52
52
|
treetop (~> 1.4.8)
|
53
|
-
mime-types (1.
|
54
|
-
minitest (
|
55
|
-
multi_json (1.
|
56
|
-
polyglot (0.3.
|
53
|
+
mime-types (1.25.1)
|
54
|
+
minitest (5.3.4)
|
55
|
+
multi_json (1.10.1)
|
56
|
+
polyglot (0.3.4)
|
57
57
|
rack (1.5.2)
|
58
58
|
rack-test (0.6.2)
|
59
59
|
rack (>= 1.0)
|
60
|
-
rails (4.
|
61
|
-
actionmailer (= 4.
|
62
|
-
actionpack (= 4.
|
63
|
-
|
64
|
-
|
60
|
+
rails (4.1.1)
|
61
|
+
actionmailer (= 4.1.1)
|
62
|
+
actionpack (= 4.1.1)
|
63
|
+
actionview (= 4.1.1)
|
64
|
+
activemodel (= 4.1.1)
|
65
|
+
activerecord (= 4.1.1)
|
66
|
+
activesupport (= 4.1.1)
|
65
67
|
bundler (>= 1.3.0, < 2.0)
|
66
|
-
railties (= 4.
|
67
|
-
sprockets-rails (~> 2.0
|
68
|
-
railties (4.
|
69
|
-
actionpack (= 4.
|
70
|
-
activesupport (= 4.
|
68
|
+
railties (= 4.1.1)
|
69
|
+
sprockets-rails (~> 2.0)
|
70
|
+
railties (4.1.1)
|
71
|
+
actionpack (= 4.1.1)
|
72
|
+
activesupport (= 4.1.1)
|
71
73
|
rake (>= 0.8.7)
|
72
74
|
thor (>= 0.18.1, < 2.0)
|
73
|
-
rake (10.
|
74
|
-
rdoc (
|
75
|
+
rake (10.3.2)
|
76
|
+
rdoc (4.1.1)
|
75
77
|
json (~> 1.4)
|
76
|
-
sass (3.2.
|
77
|
-
sass-rails (4.0.
|
78
|
-
railties (>= 4.0.0
|
79
|
-
sass (
|
80
|
-
sprockets
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
sass (3.2.19)
|
79
|
+
sass-rails (4.0.3)
|
80
|
+
railties (>= 4.0.0, < 5.0)
|
81
|
+
sass (~> 3.2.0)
|
82
|
+
sprockets (~> 2.8, <= 2.11.0)
|
83
|
+
sprockets-rails (~> 2.0)
|
84
|
+
sdoc (0.4.0)
|
85
|
+
json (~> 1.8)
|
86
|
+
rdoc (~> 4.0, < 5.0)
|
87
|
+
spring (1.0.0)
|
88
|
+
sprockets (2.11.0)
|
85
89
|
hike (~> 1.2)
|
86
90
|
multi_json (~> 1.0)
|
87
91
|
rack (~> 1.0)
|
88
92
|
tilt (~> 1.1, != 1.3.0)
|
89
|
-
sprockets-rails (2.
|
93
|
+
sprockets-rails (2.1.3)
|
90
94
|
actionpack (>= 3.0)
|
91
95
|
activesupport (>= 3.0)
|
92
96
|
sprockets (~> 2.8)
|
93
|
-
sqlite3 (1.3.
|
94
|
-
thor (0.
|
95
|
-
thread_safe (0.
|
96
|
-
atomic
|
97
|
+
sqlite3 (1.3.8)
|
98
|
+
thor (0.19.1)
|
99
|
+
thread_safe (0.3.3)
|
97
100
|
tilt (1.4.1)
|
98
|
-
treetop (1.4.
|
101
|
+
treetop (1.4.15)
|
99
102
|
polyglot
|
100
103
|
polyglot (>= 0.3.1)
|
101
|
-
turbolinks (
|
104
|
+
turbolinks (2.2.0)
|
102
105
|
coffee-rails
|
103
|
-
tzinfo (
|
104
|
-
|
106
|
+
tzinfo (1.1.0)
|
107
|
+
thread_safe (~> 0.1)
|
108
|
+
uglifier (2.4.0)
|
105
109
|
execjs (>= 0.3.0)
|
106
|
-
|
110
|
+
json (>= 1.8.0)
|
107
111
|
|
108
112
|
PLATFORMS
|
109
113
|
ruby
|
110
114
|
|
111
115
|
DEPENDENCIES
|
112
|
-
coffee-rails
|
113
|
-
jbuilder (~>
|
116
|
+
coffee-rails (~> 4.0.0)
|
117
|
+
jbuilder (~> 2.0)
|
114
118
|
jquery-rails
|
115
|
-
rails (= 4.
|
116
|
-
sass-rails
|
117
|
-
sdoc
|
119
|
+
rails (= 4.1.1)
|
120
|
+
sass-rails (~> 4.0.3)
|
121
|
+
sdoc (~> 0.4.0)
|
122
|
+
spring
|
118
123
|
sqlite3
|
119
124
|
turbolinks
|
120
|
-
uglifier (>= 1.0
|
125
|
+
uglifier (>= 1.3.0)
|
@@ -7,8 +7,7 @@
|
|
7
7
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
8
|
// compiled file.
|
9
9
|
//
|
10
|
-
//
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
10
|
+
// stub path allows dependency to be excluded from the asset bundle.
|
12
11
|
//
|
13
12
|
//= require jquery
|
14
13
|
//= require jquery_ujs
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Blog</title>
|
5
|
-
<%= stylesheet_link_tag
|
6
|
-
<%= javascript_include_tag
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
7
|
<%= csrf_meta_tags %>
|
8
8
|
</head>
|
9
9
|
<body>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
@@ -22,7 +22,7 @@ Blog::Application.configure do
|
|
22
22
|
# Only use best-standards-support built into browsers.
|
23
23
|
config.action_dispatch.best_standards_support = :builtin
|
24
24
|
|
25
|
-
# Raise an error on page load if there are pending migrations
|
25
|
+
# Raise an error on page load if there are pending migrations.
|
26
26
|
config.active_record.migration_error = :page_load
|
27
27
|
|
28
28
|
# Debug mode disables concatenation and preprocessing of assets.
|
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# Code is not reloaded between requests.
|
5
5
|
config.cache_classes = true
|
6
6
|
|
7
7
|
# Eager load code on boot. This eager loads most of Rails and
|
8
|
-
# your application in memory, allowing both
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
9
|
# and those relying on copy on write to perform better.
|
10
10
|
# Rake tasks automatically ignore this option for performance.
|
11
11
|
config.eager_load = true
|
@@ -66,7 +66,7 @@ Blog::Application.configure do
|
|
66
66
|
# config.action_mailer.raise_delivery_errors = false
|
67
67
|
|
68
68
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
-
# the I18n.default_locale when a translation
|
69
|
+
# the I18n.default_locale when a translation cannot be found).
|
70
70
|
config.i18n.fallbacks = true
|
71
71
|
|
72
72
|
# Send deprecation notices to registered listeners.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
@@ -14,7 +14,7 @@ Blog::Application.configure do
|
|
14
14
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
16
16
|
config.serve_static_assets = true
|
17
|
-
config.static_cache_control =
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
18
18
|
|
19
19
|
# Show full error reports and disable caching.
|
20
20
|
config.consider_all_requests_local = true
|
@@ -9,4 +9,4 @@
|
|
9
9
|
|
10
10
|
# Make sure your secret_key_base is kept private
|
11
11
|
# if you're sharing your code publicly.
|
12
|
-
|
12
|
+
Rails.application.config.secret_key_base = 'e8aab50cec8a06a75694111a4cbaf6e22fc288ccbc6b268683aae7273043c69b15ca07d10c92a788dd6077a54762cbfcc55f19c3459f7531221b3169f8171a53'
|
@@ -22,6 +22,7 @@
|
|
22
22
|
border-top-right-radius: 9px;
|
23
23
|
background-color: white;
|
24
24
|
padding: 7px 4em 0 4em;
|
25
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
25
26
|
}
|
26
27
|
|
27
28
|
h1 {
|
@@ -37,6 +38,7 @@
|
|
37
38
|
background-color: #F7F7F7;
|
38
39
|
border: 1px solid #CCC;
|
39
40
|
border-right-color: #999;
|
41
|
+
border-left-color: #999;
|
40
42
|
border-bottom-color: #999;
|
41
43
|
border-bottom-left-radius: 4px;
|
42
44
|
border-bottom-right-radius: 4px;
|
@@ -22,6 +22,7 @@
|
|
22
22
|
border-top-right-radius: 9px;
|
23
23
|
background-color: white;
|
24
24
|
padding: 7px 4em 0 4em;
|
25
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
25
26
|
}
|
26
27
|
|
27
28
|
h1 {
|
@@ -37,6 +38,7 @@
|
|
37
38
|
background-color: #F7F7F7;
|
38
39
|
border: 1px solid #CCC;
|
39
40
|
border-right-color: #999;
|
41
|
+
border-left-color: #999;
|
40
42
|
border-bottom-color: #999;
|
41
43
|
border-bottom-left-radius: 4px;
|
42
44
|
border-bottom-right-radius: 4px;
|
@@ -22,6 +22,7 @@
|
|
22
22
|
border-top-right-radius: 9px;
|
23
23
|
background-color: white;
|
24
24
|
padding: 7px 4em 0 4em;
|
25
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
25
26
|
}
|
26
27
|
|
27
28
|
h1 {
|
@@ -37,6 +38,7 @@
|
|
37
38
|
background-color: #F7F7F7;
|
38
39
|
border: 1px solid #CCC;
|
39
40
|
border-right-color: #999;
|
41
|
+
border-left-color: #999;
|
40
42
|
border-bottom-color: #999;
|
41
43
|
border-bottom-left-radius: 4px;
|
42
44
|
border-bottom-right-radius: 4px;
|
@@ -6,9 +6,6 @@ class ActiveSupport::TestCase
|
|
6
6
|
ActiveRecord::Migration.check_pending!
|
7
7
|
|
8
8
|
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
9
|
-
#
|
10
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
11
|
-
# -- they do not yet inherit this setting
|
12
9
|
fixtures :all
|
13
10
|
|
14
11
|
# Add more helper methods to be used by all tests here...
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
module RailsGuides
|
2
4
|
module Helpers
|
3
5
|
def guide(name, url, options = {}, &block)
|
@@ -17,7 +19,7 @@ module RailsGuides
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def documents_flat
|
20
|
-
documents_by_section.
|
22
|
+
documents_by_section.flat_map {|section| section['documents']}
|
21
23
|
end
|
22
24
|
|
23
25
|
def finished_documents(documents)
|
@@ -327,7 +327,7 @@ Other features of memoization include `unmemoize`, `unmemoize_all`, and `memoize
|
|
327
327
|
The `each_with_object` method provides an alternative to `inject`, using a method backported from Ruby 1.9. It iterates over a collection, passing the current element and the memo into the block.
|
328
328
|
|
329
329
|
```ruby
|
330
|
-
%w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase }
|
330
|
+
%w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase } # => {'foo' => 'FOO', 'bar' => 'BAR'}
|
331
331
|
```
|
332
332
|
|
333
333
|
Lead Contributor: [Adam Keys](http://therealadam.com/)
|
@@ -366,7 +366,7 @@ Lead Contributor: [Daniel Schierbeck](http://workingwithrails.com/person/5830-da
|
|
366
366
|
* `Inflector#parameterize` produces a URL-ready version of its input, for use in `to_param`.
|
367
367
|
* `Time#advance` recognizes fractional days and weeks, so you can do `1.7.weeks.ago`, `1.5.hours.since`, and so on.
|
368
368
|
* The included TzInfo library has been upgraded to version 0.3.12.
|
369
|
-
* `
|
369
|
+
* `ActiveSupport::StringInquirer` gives you a pretty way to test for equality in strings: `ActiveSupport::StringInquirer.new("abc").abc? => true`
|
370
370
|
|
371
371
|
Railties
|
372
372
|
--------
|
@@ -40,7 +40,7 @@ Here's a summary of the rack-related changes:
|
|
40
40
|
* `ActiveRecord::QueryCache` middleware is automatically inserted onto the middleware stack if `ActiveRecord` has been loaded. This middleware sets up and flushes the per-request Active Record query cache.
|
41
41
|
* The Rails router and controller classes follow the Rack spec. You can call a controller directly with `SomeController.call(env)`. The router stores the routing parameters in `rack.routing_args`.
|
42
42
|
* `ActionController::Request` inherits from `Rack::Request`.
|
43
|
-
* Instead of `config.action_controller.session = { :session_key => 'foo', ...` use
|
43
|
+
* Instead of `config.action_controller.session = { :session_key => 'foo', ...` use `config.action_controller.session = { :key => 'foo', ...`.
|
44
44
|
* Using the `ParamsParser` middleware preprocesses any XML, JSON, or YAML requests so they can be read normally with any `Rack::Request` object after it.
|
45
45
|
|
46
46
|
### Renewed Support for Rails Engines
|
@@ -173,8 +173,8 @@ before_save :update_credit_rating, :if => :active,
|
|
173
173
|
Rails now has a `:having` option on find (as well as on `has_many` and `has_and_belongs_to_many` associations) for filtering records in grouped finds. As those with heavy SQL backgrounds know, this allows filtering based on grouped results:
|
174
174
|
|
175
175
|
```ruby
|
176
|
-
developers =
|
177
|
-
:having => "sum(salary) >
|
176
|
+
developers = Developer.find(:all, :group => "salary",
|
177
|
+
:having => "sum(salary) > 10000", :select => "salary")
|
178
178
|
```
|
179
179
|
|
180
180
|
* Lead Contributor: [Emilio Tagua](http://github.com/miloops)
|
@@ -237,7 +237,7 @@ If you're one of the people who has always been bothered by the special-case nam
|
|
237
237
|
|
238
238
|
### HTTP Digest Authentication Support
|
239
239
|
|
240
|
-
Rails now has built-in support for HTTP digest authentication. To use it, you call `authenticate_or_request_with_http_digest` with a block that returns the user
|
240
|
+
Rails now has built-in support for HTTP digest authentication. To use it, you call `authenticate_or_request_with_http_digest` with a block that returns the user's password (which is then hashed and compared against the transmitted credentials):
|
241
241
|
|
242
242
|
```ruby
|
243
243
|
class PostsController < ApplicationController
|
@@ -451,11 +451,11 @@ select(:post, :category, Post::CATEGORIES, :disabled => 'private')
|
|
451
451
|
returns
|
452
452
|
|
453
453
|
```html
|
454
|
-
<select name
|
454
|
+
<select name="post[category]">
|
455
455
|
<option>story</option>
|
456
456
|
<option>joke</option>
|
457
457
|
<option>poem</option>
|
458
|
-
<option disabled
|
458
|
+
<option disabled="disabled">private</option>
|
459
459
|
</select>
|
460
460
|
```
|
461
461
|
|
@@ -604,9 +604,9 @@ Deprecated
|
|
604
604
|
A few pieces of older code are deprecated in this release:
|
605
605
|
|
606
606
|
* If you're one of the (fairly rare) Rails developers who deploys in a fashion that depends on the inspector, reaper, and spawner scripts, you'll need to know that those scripts are no longer included in core Rails. If you need them, you'll be able to pick up copies via the [irs_process_scripts](http://github.com/rails/irs_process_scripts/tree) plugin.
|
607
|
-
* `render_component` goes from "deprecated" to "nonexistent" in Rails 2.3. If you still need it, you can install the [render_component plugin](http://github.com/rails/render_component/tree/master.
|
607
|
+
* `render_component` goes from "deprecated" to "nonexistent" in Rails 2.3. If you still need it, you can install the [render_component plugin](http://github.com/rails/render_component/tree/master).
|
608
608
|
* Support for Rails components has been removed.
|
609
|
-
* If you were one of the people who got used to running `script/performance/request` to look at performance based on integration tests, you need to learn a new trick: that script has been removed from core Rails now. There
|
609
|
+
* If you were one of the people who got used to running `script/performance/request` to look at performance based on integration tests, you need to learn a new trick: that script has been removed from core Rails now. There's a new request_profiler plugin that you can install to get the exact same functionality back.
|
610
610
|
* `ActionController::Base#session_enabled?` is deprecated because sessions are lazy-loaded now.
|
611
611
|
* The `:digest` and `:secret` options to `protect_from_forgery` are deprecated and have no effect.
|
612
612
|
* Some integration test helpers have been removed. `response.headers["Status"]` and `headers["Status"]` will no longer return anything. Rack does not allow "Status" in its return headers. However you can still use the `status` and `status_message` helpers. `response.headers["cookie"]` and `headers["cookie"]` will no longer return any CGI cookies. You can inspect `headers["Set-Cookie"]` to see the raw cookie header or use the `cookies` helper to get a hash of the cookies sent to the client.
|
@@ -340,7 +340,7 @@ Helpers that do something else, like `cache` or `content_for`, are not affected
|
|
340
340
|
* Helpers now output HTML 5 by default.
|
341
341
|
* Form label helper now pulls values from I18n with a single value, so `f.label :name` will pull the `:name` translation.
|
342
342
|
* I18n select label on should now be :en.helpers.select instead of :en.support.select.
|
343
|
-
* You no longer need to place a minus sign at the end of a
|
343
|
+
* You no longer need to place a minus sign at the end of a Ruby interpolation inside an ERB template to remove the trailing carriage return in the HTML output.
|
344
344
|
* Added `grouped_collection_select` helper to Action View.
|
345
345
|
* `content_for?` has been added allowing you to check for the existence of content in a view before rendering.
|
346
346
|
* passing `:value => nil` to form helpers will set the field's `value` attribute to nil as opposed to using the default value
|
@@ -574,7 +574,7 @@ The following methods have been removed because they are no longer used in the f
|
|
574
574
|
Action Mailer
|
575
575
|
-------------
|
576
576
|
|
577
|
-
Action Mailer has been given a new API with TMail being replaced out with the new [Mail](http://github.com/mikel/mail) as the
|
577
|
+
Action Mailer has been given a new API with TMail being replaced out with the new [Mail](http://github.com/mikel/mail) as the email library. Action Mailer itself has been given an almost complete re-write with pretty much every line of code touched. The result is that Action Mailer now simply inherits from Abstract Controller and wraps the Mail gem in a Rails DSL. This reduces the amount of code and duplication of other libraries in Action Mailer considerably.
|
578
578
|
|
579
579
|
* All mailers are now in `app/mailers` by default.
|
580
580
|
* Can now send email using new API with three methods: `attachments`, `headers` and `mail`.
|
@@ -609,4 +609,3 @@ Credits
|
|
609
609
|
See the [full list of contributors to Rails](http://contributors.rubyonrails.org/) for the many people who spent many hours making Rails 3. Kudos to all of them.
|
610
610
|
|
611
611
|
Rails 3.0 Release Notes were compiled by [Mikel Lindsaar](http://lindsaar.net.)
|
612
|
-
|
@@ -169,7 +169,7 @@ Rails Architectural Changes
|
|
169
169
|
|
170
170
|
The major change in Rails 3.1 is the Assets Pipeline. It makes CSS and JavaScript first-class code citizens and enables proper organization, including use in plugins and engines.
|
171
171
|
|
172
|
-
The assets pipeline is powered by [Sprockets](https://github.com/
|
172
|
+
The assets pipeline is powered by [Sprockets](https://github.com/rails/sprockets) and is covered in the [Asset Pipeline](asset_pipeline.html) guide.
|
173
173
|
|
174
174
|
### HTTP Streaming
|
175
175
|
|
@@ -286,7 +286,7 @@ Action Pack
|
|
286
286
|
end
|
287
287
|
```
|
288
288
|
|
289
|
-
You can restrict it to some actions by using `:only` or `:except`. Please read the docs at [`ActionController::Streaming`](http://api.rubyonrails.org/classes/ActionController/Streaming.html) for more information.
|
289
|
+
You can restrict it to some actions by using `:only` or `:except`. Please read the docs at [`ActionController::Streaming`](http://api.rubyonrails.org/v3.1.0/classes/ActionController/Streaming.html) for more information.
|
290
290
|
|
291
291
|
* The redirect route method now also accepts a hash of options which will only change the parts of the url in question, or an object which responds to call, allowing for redirects to be reused.
|
292
292
|
|
@@ -21,7 +21,7 @@ If you're upgrading an existing application, it's a great idea to have good test
|
|
21
21
|
|
22
22
|
Rails 3.2 requires Ruby 1.8.7 or higher. Support for all of the previous Ruby versions has been dropped officially and you should upgrade as early as possible. Rails 3.2 is also compatible with Ruby 1.9.2.
|
23
23
|
|
24
|
-
TIP: Note that Ruby 1.8.7 p248 and p249 have
|
24
|
+
TIP: Note that Ruby 1.8.7 p248 and p249 have marshalling bugs that crash Rails. Ruby Enterprise Edition has these fixed since the release of 1.8.7-2010.02. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults, so if you want to use 1.9.x, jump on to 1.9.2 or 1.9.3 for smooth sailing.
|
25
25
|
|
26
26
|
### What to update in your apps
|
27
27
|
|
@@ -137,7 +137,7 @@ Railties
|
|
137
137
|
|
138
138
|
* Update `Rails::Rack::Logger` middleware to apply any tags set in `config.log_tags` to `ActiveSupport::TaggedLogging`. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications.
|
139
139
|
|
140
|
-
* Default options to `rails new` can be set in `~/.railsrc`. You can specify extra command-line arguments to be used every time
|
140
|
+
* Default options to `rails new` can be set in `~/.railsrc`. You can specify extra command-line arguments to be used every time `rails new` runs in the `.railsrc` configuration file in your home directory.
|
141
141
|
|
142
142
|
* Add an alias `d` for `destroy`. This works for engines too.
|
143
143
|
|
@@ -185,9 +185,9 @@ Action Pack
|
|
185
185
|
end
|
186
186
|
```
|
187
187
|
|
188
|
-
Rails will use
|
188
|
+
Rails will use `layouts/single_car` when a request comes in `:show` action, and use `layouts/application` (or `layouts/cars`, if exists) when a request comes in for any other actions.
|
189
189
|
|
190
|
-
* form\_for is changed to use
|
190
|
+
* `form\_for` is changed to use `#{action}\_#{as}` as the css class and id if `:as` option is provided. Earlier versions used `#{as}\_#{action}`.
|
191
191
|
|
192
192
|
* `ActionController::ParamsWrapper` on Active Record models now only wrap `attr_accessible` attributes if they were set. If not, only the attributes returned by the class method `attribute_names` will be wrapped. This fixes the wrapping of nested attributes by adding them to `attr_accessible`.
|
193
193
|
|
@@ -219,7 +219,7 @@ Action Pack
|
|
219
219
|
|
220
220
|
* MIME type entries for PDF, ZIP and other formats were added.
|
221
221
|
|
222
|
-
* Allow fresh_when/stale
|
222
|
+
* Allow `fresh_when/stale?` to take a record instead of an options hash.
|
223
223
|
|
224
224
|
* Changed log level of warning for missing CSRF token from `:debug` to `:warn`.
|
225
225
|
|
@@ -227,7 +227,7 @@ Action Pack
|
|
227
227
|
|
228
228
|
#### Deprecations
|
229
229
|
|
230
|
-
* Deprecated implied layout lookup in controllers whose parent had
|
230
|
+
* Deprecated implied layout lookup in controllers whose parent had an explicit layout set:
|
231
231
|
|
232
232
|
```ruby
|
233
233
|
class ApplicationController
|
@@ -238,13 +238,13 @@ Action Pack
|
|
238
238
|
end
|
239
239
|
```
|
240
240
|
|
241
|
-
In the example above,
|
241
|
+
In the example above, `PostsController` will no longer automatically look up for a posts layout. If you need this functionality you could either remove `layout "application"` from `ApplicationController` or explicitly set it to `nil` in `PostsController`.
|
242
242
|
|
243
|
-
* Deprecated `ActionController::UnknownAction` in
|
243
|
+
* Deprecated `ActionController::UnknownAction` in favor of `AbstractController::ActionNotFound`.
|
244
244
|
|
245
|
-
* Deprecated `ActionController::DoubleRenderError` in
|
245
|
+
* Deprecated `ActionController::DoubleRenderError` in favor of `AbstractController::DoubleRenderError`.
|
246
246
|
|
247
|
-
* Deprecated `method_missing` in
|
247
|
+
* Deprecated `method_missing` in favor of `action_missing` for missing actions.
|
248
248
|
|
249
249
|
* Deprecated `ActionController#rescue_action`, `ActionController#initialize_template_class` and `ActionController#assign_shortcuts`.
|
250
250
|
|
@@ -254,7 +254,7 @@ Action Pack
|
|
254
254
|
|
255
255
|
* Added `ActionDispatch::RequestId` middleware that'll make a unique X-Request-Id header available to the response and enables the `ActionDispatch::Request#uuid` method. This makes it easy to trace requests from end-to-end in the stack and to identify individual requests in mixed logs like Syslog.
|
256
256
|
|
257
|
-
* The `ShowExceptions` middleware now accepts
|
257
|
+
* The `ShowExceptions` middleware now accepts an exceptions application that is responsible to render an exception when the application fails. The application is invoked with a copy of the exception in `env["action_dispatch.exception"]` and with the `PATH_INFO` rewritten to the status code.
|
258
258
|
|
259
259
|
* Allow rescue responses to be configured through a railtie as in `config.action_dispatch.rescue_responses`.
|
260
260
|
|
@@ -375,7 +375,7 @@ Active Record
|
|
375
375
|
|
376
376
|
* Support index sort order in SQLite, MySQL and PostgreSQL adapters.
|
377
377
|
|
378
|
-
* Allow the `:class_name` option for associations to take a symbol in addition to a string. This is to avoid confusing newbies, and to be consistent with the fact that other options like
|
378
|
+
* Allow the `:class_name` option for associations to take a symbol in addition to a string. This is to avoid confusing newbies, and to be consistent with the fact that other options like `:foreign_key` already allow a symbol or a string.
|
379
379
|
|
380
380
|
```ruby
|
381
381
|
has_many :clients, :class_name => :Client # Note that the symbol need to be capitalized
|