rails 4.1.4 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -10
  3. data/guides/CHANGELOG.md +15 -25
  4. data/guides/Rakefile +5 -3
  5. data/guides/assets/javascripts/guides.js +6 -0
  6. data/guides/assets/stylesheets/main.css +4 -1
  7. data/guides/bug_report_templates/action_controller_gem.rb +2 -2
  8. data/guides/bug_report_templates/action_controller_master.rb +3 -2
  9. data/guides/rails_guides/helpers.rb +1 -1
  10. data/guides/rails_guides/levenshtein.rb +29 -21
  11. data/guides/rails_guides/markdown/renderer.rb +1 -1
  12. data/guides/rails_guides/markdown.rb +11 -7
  13. data/guides/rails_guides.rb +2 -2
  14. data/guides/source/2_2_release_notes.md +1 -1
  15. data/guides/source/2_3_release_notes.md +4 -4
  16. data/guides/source/3_0_release_notes.md +8 -8
  17. data/guides/source/3_1_release_notes.md +5 -2
  18. data/guides/source/3_2_release_notes.md +6 -3
  19. data/guides/source/4_0_release_notes.md +6 -3
  20. data/guides/source/4_1_release_notes.md +10 -11
  21. data/guides/source/4_2_release_notes.md +850 -0
  22. data/guides/source/_license.html.erb +1 -1
  23. data/guides/source/_welcome.html.erb +2 -8
  24. data/guides/source/action_controller_overview.md +84 -10
  25. data/guides/source/action_mailer_basics.md +91 -28
  26. data/guides/source/action_view_overview.md +140 -130
  27. data/guides/source/active_job_basics.md +318 -0
  28. data/guides/source/active_model_basics.md +371 -17
  29. data/guides/source/active_record_basics.md +19 -18
  30. data/guides/source/active_record_callbacks.md +12 -9
  31. data/guides/source/{migrations.md → active_record_migrations.md} +135 -226
  32. data/guides/source/active_record_postgresql.md +433 -0
  33. data/guides/source/active_record_querying.md +269 -259
  34. data/guides/source/active_record_validations.md +21 -12
  35. data/guides/source/active_support_core_extensions.md +113 -73
  36. data/guides/source/active_support_instrumentation.md +10 -7
  37. data/guides/source/api_documentation_guidelines.md +62 -16
  38. data/guides/source/asset_pipeline.md +264 -67
  39. data/guides/source/association_basics.md +81 -74
  40. data/guides/source/caching_with_rails.md +32 -7
  41. data/guides/source/command_line.md +52 -30
  42. data/guides/source/configuring.md +132 -29
  43. data/guides/source/constant_autoloading_and_reloading.md +1297 -0
  44. data/guides/source/contributing_to_ruby_on_rails.md +192 -112
  45. data/guides/source/credits.html.erb +2 -2
  46. data/guides/source/debugging_rails_applications.md +448 -294
  47. data/guides/source/development_dependencies_install.md +47 -36
  48. data/guides/source/documents.yaml +19 -7
  49. data/guides/source/engines.md +210 -189
  50. data/guides/source/form_helpers.md +79 -56
  51. data/guides/source/generators.md +24 -11
  52. data/guides/source/getting_started.md +339 -201
  53. data/guides/source/i18n.md +111 -68
  54. data/guides/source/index.html.erb +1 -0
  55. data/guides/source/initialization.md +109 -62
  56. data/guides/source/layout.html.erb +1 -4
  57. data/guides/source/layouts_and_rendering.md +18 -17
  58. data/guides/source/maintenance_policy.md +26 -4
  59. data/guides/source/nested_model_forms.md +7 -4
  60. data/guides/source/plugins.md +27 -27
  61. data/guides/source/rails_application_templates.md +21 -3
  62. data/guides/source/rails_on_rack.md +12 -9
  63. data/guides/source/routing.md +100 -74
  64. data/guides/source/ruby_on_rails_guides_guidelines.md +11 -12
  65. data/guides/source/security.md +40 -34
  66. data/guides/source/testing.md +188 -117
  67. data/guides/source/upgrading_ruby_on_rails.md +284 -29
  68. data/guides/source/working_with_javascript_in_rails.md +18 -16
  69. data/guides/w3c_validator.rb +2 -0
  70. metadata +40 -94
  71. data/guides/code/getting_started/Gemfile +0 -40
  72. data/guides/code/getting_started/Gemfile.lock +0 -125
  73. data/guides/code/getting_started/README.rdoc +0 -28
  74. data/guides/code/getting_started/Rakefile +0 -6
  75. data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
  76. data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
  77. data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
  78. data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
  79. data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
  80. data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
  81. data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
  82. data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
  83. data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
  84. data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -23
  85. data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -53
  86. data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
  87. data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
  88. data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
  89. data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
  90. data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
  91. data/guides/code/getting_started/app/models/comment.rb +0 -3
  92. data/guides/code/getting_started/app/models/post.rb +0 -7
  93. data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
  94. data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
  95. data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
  96. data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
  97. data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
  98. data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
  99. data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
  100. data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
  101. data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -4
  102. data/guides/code/getting_started/bin/bundle +0 -4
  103. data/guides/code/getting_started/bin/rails +0 -4
  104. data/guides/code/getting_started/bin/rake +0 -4
  105. data/guides/code/getting_started/config/application.rb +0 -18
  106. data/guides/code/getting_started/config/boot.rb +0 -4
  107. data/guides/code/getting_started/config/database.yml +0 -25
  108. data/guides/code/getting_started/config/environment.rb +0 -5
  109. data/guides/code/getting_started/config/environments/development.rb +0 -30
  110. data/guides/code/getting_started/config/environments/production.rb +0 -80
  111. data/guides/code/getting_started/config/environments/test.rb +0 -36
  112. data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
  113. data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
  114. data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
  115. data/guides/code/getting_started/config/initializers/locale.rb +0 -9
  116. data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
  117. data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
  118. data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
  119. data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
  120. data/guides/code/getting_started/config/locales/en.yml +0 -23
  121. data/guides/code/getting_started/config/routes.rb +0 -7
  122. data/guides/code/getting_started/config.ru +0 -4
  123. data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
  124. data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
  125. data/guides/code/getting_started/db/schema.rb +0 -33
  126. data/guides/code/getting_started/db/seeds.rb +0 -7
  127. data/guides/code/getting_started/public/404.html +0 -60
  128. data/guides/code/getting_started/public/422.html +0 -60
  129. data/guides/code/getting_started/public/500.html +0 -59
  130. data/guides/code/getting_started/public/favicon.ico +0 -0
  131. data/guides/code/getting_started/public/robots.txt +0 -5
  132. data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
  133. data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
  134. data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
  135. data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
  136. data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
  137. data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
  138. data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
  139. data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
  140. data/guides/code/getting_started/test/models/comment_test.rb +0 -7
  141. data/guides/code/getting_started/test/models/post_test.rb +0 -7
  142. data/guides/code/getting_started/test/test_helper.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8fb2532951e8d68559a5ccc77dcbea0345f0f15
4
- data.tar.gz: 0da92b997baabfe85b105ac3c32c67622c848847
3
+ metadata.gz: 820f40537f6670c1bf36f61979047ac3b8173437
4
+ data.tar.gz: 19860336f8213b3e83f09118a638d40a67b625bb
5
5
  SHA512:
6
- metadata.gz: ed91a443b2c26ac7b768e38d6ea0b57f56665bdcae281962c25668c4a4a090f221984c6c4304efe3482e88f88dbf9535a5cc4cf80d9b19f993b32480d1da0920
7
- data.tar.gz: 8d8df1f2e7b2a25c2bff50da0df0ce422b0a35854b0993d634921eefd19d1a1b79001d16fc3a9d2b8c7c42fb3072fdd3389ac04bb79cce2df2c9fc3692e1a591
6
+ metadata.gz: 0d9aba1fdb1c9bcf61616777f57854700e8b58fde7a17eed6d39e5fed8e95751bccefc834a94aa2fd03e11f1aa4939dc7e7a48736d5e9dcda1b4ab28cc3ab094
7
+ data.tar.gz: 0c778c7b93788d1f30764afe47f47a761c423f7d501b322c56a6ed0f66cd2147f85eda2c3a6bbb92283ed792868f36b6e6b3c1f860a81cd169c354d0823a3336
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Rails is a web-application framework that includes everything needed to
4
4
  create database-backed web applications according to the
5
- [Model-View-Controller (MVC)](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller)
5
+ [Model-View-Controller (MVC)](http://en.wikipedia.org/wiki/Model-view-controller)
6
6
  pattern.
7
7
 
8
8
  Understanding the MVC pattern is key to understanding Rails. MVC divides your
@@ -13,10 +13,10 @@ Person, Post, etc.) and encapsulates the business logic that is specific to
13
13
  your application. In Rails, database-backed model classes are derived from
14
14
  `ActiveRecord::Base`. Active Record allows you to present the data from
15
15
  database rows as objects and embellish these data objects with business logic
16
- methods. Although most Rails models are backed by a database, models can also
17
- be ordinary Ruby classes, or Ruby classes that implement a set of interfaces
18
- as provided by the Active Model module. You can read more about Active Record
19
- in its [README](activerecord/README.rdoc).
16
+ methods. You can read more about Active Record in its [README](activerecord/README.rdoc).
17
+ Although most Rails models are backed by a database, models can also be ordinary
18
+ Ruby classes, or Ruby classes that implement a set of interfaces as provided by
19
+ the Active Model module. You can read more about Active Model in its [README](activemodel/README.rdoc).
20
20
 
21
21
  The _Controller layer_ is responsible for handling incoming HTTP requests and
22
22
  providing a suitable response. Usually this means returning HTML, but Rails controllers
@@ -36,9 +36,11 @@ You can read more about Action View in its [README](actionview/README.rdoc).
36
36
 
37
37
  Active Record, Action Pack, and Action View can each be used independently outside Rails.
38
38
  In addition to them, Rails also comes with Action Mailer ([README](actionmailer/README.rdoc)), a library
39
- to generate and send emails; and Active Support ([README](activesupport/README.rdoc)), a collection of
40
- utility classes and standard library extensions that are useful for Rails, and may also be used
41
- independently outside Rails.
39
+ to generate and send emails; Active Job ([README](activejob/README.md)), a
40
+ framework for declaring jobs and making them run on a variety of queueing
41
+ backends; and Active Support ([README](activesupport/README.rdoc)), a collection
42
+ of utility classes and standard library extensions that are useful for Rails,
43
+ and may also be used independently outside Rails.
42
44
 
43
45
  ## Getting Started
44
46
 
@@ -67,7 +69,7 @@ independently outside Rails.
67
69
  * [Getting Started with Rails](http://guides.rubyonrails.org/getting_started.html)
68
70
  * [Ruby on Rails Guides](http://guides.rubyonrails.org)
69
71
  * [The API Documentation](http://api.rubyonrails.org)
70
- * [Ruby on Rails Tutorial](http://ruby.railstutorial.org/ruby-on-rails-tutorial-book)
72
+ * [Ruby on Rails Tutorial](http://www.railstutorial.org/book)
71
73
 
72
74
  ## Contributing
73
75
 
@@ -76,7 +78,7 @@ We encourage you to contribute to Ruby on Rails! Please check out the
76
78
 
77
79
  ## Code Status
78
80
 
79
- * [![Build Status](https://travis-ci.org/rails/rails.png?branch=master)](https://travis-ci.org/rails/rails)
81
+ * [![Build Status](https://travis-ci.org/rails/rails.svg?branch=4-2-stable)](https://travis-ci.org/rails/rails)
80
82
 
81
83
  ## License
82
84
 
data/guides/CHANGELOG.md CHANGED
@@ -1,41 +1,31 @@
1
- ## Rails 4.1.4 (July 2, 2014) ##
1
+ * New guide about constant autoloading and reloading.
2
2
 
3
- * No changes.
3
+ *Xavier Noria*
4
4
 
5
+ * Change Posts to Articles in Getting Started sample application in order to
6
+ better align with the actual guides.
5
7
 
6
- ## Rails 4.1.3 (July 2, 2014) ##
7
-
8
- * No changes.
9
-
10
-
11
- ## Rails 4.1.2 (June 26, 2014) ##
8
+ *John Kelly Ferguson*
12
9
 
13
10
  * Update all Rails 4.1.0 references to 4.1.1 within the guides and code.
14
11
 
15
12
  *John Kelly Ferguson*
16
13
 
17
- * Updates the maintenance policy to match the latest versions of Rails.
18
-
19
- *Matias Korhonen*
20
-
14
+ * Split up rows in the Explain Queries table of the ActiveRecord Querying section
15
+ in order to improve readability.
21
16
 
22
- ## Rails 4.1.1 (May 6, 2014) ##
23
-
24
- * No changes.
25
-
26
-
27
- ## Rails 4.1.0 (April 8, 2014) ##
17
+ *John Kelly Ferguson*
28
18
 
29
- * Fixed missing line and shadow on service pages(404, 422, 500).
19
+ * Change all non-HTTP method 'post' references to 'article'.
30
20
 
31
- *Dmitry Korotkov*
21
+ *John Kelly Ferguson*
32
22
 
33
- * Removed repetitive th tags. Instead of them added one th tag with a colspan attribute.
23
+ * Updates the maintenance policy to match the latest versions of Rails
34
24
 
35
- *Sıtkı Bağdat*
25
+ *Matias Korhonen*
36
26
 
37
- * Added the Rails maintenance policy to the guides.
27
+ * Switched the order of `Applying a default scope` and `Merging of scopes` subsections so default scopes are introduced first.
38
28
 
39
- *Matias Korhonen*
29
+ *Alex Riabov*
40
30
 
41
- Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/guides/CHANGELOG.md) for previous changes.
31
+ Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/guides/CHANGELOG.md) for previous changes.
data/guides/Rakefile CHANGED
@@ -13,8 +13,8 @@ namespace :guides do
13
13
 
14
14
  desc "Generate .mobi file. The kindlegen executable must be in your PATH. You can get it for free from http://www.amazon.com/kindlepublishing"
15
15
  task :kindle do
16
- unless `kindlerb -v 2> /dev/null` =~ /kindlerb 0.1.1/
17
- abort "Please `gem install kindlerb`"
16
+ unless `kindlerb -v 2> /dev/null` =~ /kindlerb 0.1.1/
17
+ abort "Please `gem install kindlerb` and make sure you have `kindlegen` in your PATH"
18
18
  end
19
19
  unless `convert` =~ /convert/
20
20
  abort "Please install ImageMagick`"
@@ -34,10 +34,12 @@ namespace :guides do
34
34
  task :help do
35
35
  puts <<-help
36
36
 
37
- Guides are taken from the source directory, and the resulting HTML goes into the
37
+ Guides are taken from the source directory, and the result goes into the
38
38
  output directory. Assets are stored under files, and copied to output/files as
39
39
  part of the generation process.
40
40
 
41
+ You can generate HTML, Kindle or both formats using the `guides:generate` task.
42
+
41
43
  All this process is handled via rake tasks, here's a full list of them:
42
44
 
43
45
  #{%x[rake -T]}
@@ -51,3 +51,9 @@ var guidesIndex = {
51
51
  window.location = url;
52
52
  }
53
53
  };
54
+
55
+ // Disable autolink inside example code blocks of guides.
56
+ $(document).ready(function() {
57
+ SyntaxHighlighter.defaults['auto-links'] = false;
58
+ SyntaxHighlighter.all();
59
+ });
@@ -381,9 +381,12 @@ a, a:link, a:visited {
381
381
  font: inherit;
382
382
  padding-left: .75em;
383
383
  font-size: .95em;
384
- background-position: 96% -65px;
384
+ background-position: 96% 16px;
385
385
  -webkit-appearance: none;
386
386
  }
387
+ .guides-index-small .guides-index-item:hover{
388
+ background-position: 96% -65px;
389
+ }
387
390
  }
388
391
 
389
392
  #guides {
@@ -7,8 +7,8 @@ require 'action_controller/railtie'
7
7
  class TestApp < Rails::Application
8
8
  config.root = File.dirname(__FILE__)
9
9
  config.session_store :cookie_store, key: 'cookie_store_key'
10
- config.secret_token = 'secret_token'
11
- config.secret_key_base = 'secret_key_base'
10
+ secrets.secret_token = 'secret_token'
11
+ secrets.secret_key_base = 'secret_key_base'
12
12
 
13
13
  config.logger = Logger.new($stdout)
14
14
  Rails.logger = config.logger
@@ -2,6 +2,7 @@ unless File.exist?('Gemfile')
2
2
  File.write('Gemfile', <<-GEMFILE)
3
3
  source 'https://rubygems.org'
4
4
  gem 'rails', github: 'rails/rails'
5
+ gem 'arel', github: 'rails/arel'
5
6
  GEMFILE
6
7
 
7
8
  system 'bundle'
@@ -16,8 +17,8 @@ require 'action_controller/railtie'
16
17
  class TestApp < Rails::Application
17
18
  config.root = File.dirname(__FILE__)
18
19
  config.session_store :cookie_store, key: 'cookie_store_key'
19
- config.secret_token = 'secret_token'
20
- config.secret_key_base = 'secret_key_base'
20
+ secrets.secret_token = 'secret_token'
21
+ secrets.secret_key_base = 'secret_key_base'
21
22
 
22
23
  config.logger = Logger.new($stdout)
23
24
  Rails.logger = config.logger
@@ -39,7 +39,7 @@ module RailsGuides
39
39
  def author(name, nick, image = 'credits_pic_blank.gif', &block)
40
40
  image = "images/#{image}"
41
41
 
42
- result = content_tag(:img, nil, :src => image, :class => 'left pic', :alt => name, :width => 91, :height => 91)
42
+ result = tag(:img, :src => image, :class => 'left pic', :alt => name, :width => 91, :height => 91)
43
43
  result << content_tag(:h3, name)
44
44
  result << content_tag(:p, capture(&block))
45
45
  content_tag(:div, result, :class => 'clearfix', :id => nick)
@@ -1,31 +1,39 @@
1
1
  module RailsGuides
2
2
  module Levenshtein
3
- # Based on the pseudocode in http://en.wikipedia.org/wiki/Levenshtein_distance
4
- def self.distance(s1, s2)
5
- s = s1.unpack('U*')
6
- t = s2.unpack('U*')
7
- m = s.length
8
- n = t.length
3
+ # This code is based directly on the Text gem implementation
4
+ # Returns a value representing the "cost" of transforming str1 into str2
5
+ def self.distance str1, str2
6
+ s = str1
7
+ t = str2
8
+ n = s.length
9
+ m = t.length
10
+ max = n/2
9
11
 
10
- # matrix initialization
11
- d = []
12
- 0.upto(m) { |i| d << [i] }
13
- 0.upto(n) { |j| d[0][j] = j }
12
+ return m if (0 == n)
13
+ return n if (0 == m)
14
+ return n if (n - m).abs > max
14
15
 
15
- # distance computation
16
- 1.upto(m) do |i|
17
- 1.upto(n) do |j|
18
- cost = s[i] == t[j] ? 0 : 1
19
- d[i][j] = [
20
- d[i-1][j] + 1, # deletion
21
- d[i][j-1] + 1, # insertion
22
- d[i-1][j-1] + cost, # substitution
23
- ].min
16
+ d = (0..m).to_a
17
+ x = nil
18
+
19
+ str1.each_char.each_with_index do |char1,i|
20
+ e = i+1
21
+
22
+ str2.each_char.each_with_index do |char2,j|
23
+ cost = (char1 == char2) ? 0 : 1
24
+ x = [
25
+ d[j+1] + 1, # insertion
26
+ e + 1, # deletion
27
+ d[j] + cost # substitution
28
+ ].min
29
+ d[j] = e
30
+ e = x
24
31
  end
32
+
33
+ d[m] = x
25
34
  end
26
35
 
27
- # all done
28
- return d[m][n]
36
+ return x
29
37
  end
30
38
  end
31
39
  end
@@ -50,7 +50,7 @@ HTML
50
50
  when 'erb'
51
51
  'ruby; html-script: true'
52
52
  when 'html'
53
- 'xml' # html is understood, but there are .xml rules in the CSS
53
+ 'xml' # HTML is understood, but there are .xml rules in the CSS
54
54
  else
55
55
  'plain'
56
56
  end
@@ -47,8 +47,12 @@ module RailsGuides
47
47
  end
48
48
 
49
49
  def dom_id_text(text)
50
- text.downcase.gsub(/\?/, '-questionmark').gsub(/!/, '-bang').gsub(/[^a-z0-9]+/, ' ')
51
- .strip.gsub(/\s+/, '-')
50
+ escaped_chars = Regexp.escape('\\/`*_{}[]()#+-.!:,;|&<>^~=\'"')
51
+
52
+ text.downcase.gsub(/\?/, '-questionmark')
53
+ .gsub(/!/, '-bang')
54
+ .gsub(/[#{escaped_chars}]+/, ' ').strip
55
+ .gsub(/\s+/, '-')
52
56
  end
53
57
 
54
58
  def engine
@@ -79,10 +83,10 @@ module RailsGuides
79
83
  def generate_structure
80
84
  @headings_for_index = []
81
85
  if @body.present?
82
- @body = Nokogiri::HTML(@body).tap do |doc|
86
+ @body = Nokogiri::HTML.fragment(@body).tap do |doc|
83
87
  hierarchy = []
84
88
 
85
- doc.at('body').children.each do |node|
89
+ doc.children.each do |node|
86
90
  if node.name =~ /^h[3-6]$/
87
91
  case node.name
88
92
  when 'h3'
@@ -116,7 +120,7 @@ module RailsGuides
116
120
  end
117
121
  end
118
122
 
119
- @index = Nokogiri::HTML(engine.render(raw_index)).tap do |doc|
123
+ @index = Nokogiri::HTML.fragment(engine.render(raw_index)).tap do |doc|
120
124
  doc.at('ol')[:class] = 'chapters'
121
125
  end.to_html
122
126
 
@@ -130,8 +134,8 @@ module RailsGuides
130
134
  end
131
135
 
132
136
  def generate_title
133
- if heading = Nokogiri::HTML(@header).at(:h2)
134
- @title = "#{heading.text} — Ruby on Rails Guides".html_safe
137
+ if heading = Nokogiri::HTML.fragment(@header).at(:h2)
138
+ @title = "#{heading.text} — Ruby on Rails Guides"
135
139
  else
136
140
  @title = "Ruby on Rails Guides"
137
141
  end
@@ -24,11 +24,11 @@ begin
24
24
  require 'redcarpet'
25
25
  rescue LoadError
26
26
  # This can happen if doc:guides is executed in an application.
27
- $stderr.puts('Generating guides requires Redcarpet 2.1.1+.')
27
+ $stderr.puts('Generating guides requires Redcarpet 3.1.2+.')
28
28
  $stderr.puts(<<ERROR) if bundler?
29
29
  Please add
30
30
 
31
- gem 'redcarpet', '~> 2.1.1'
31
+ gem 'redcarpet', '~> 3.1.2'
32
32
 
33
33
  to the Gemfile, run
34
34
 
@@ -1,7 +1,7 @@
1
1
  Ruby on Rails 2.2 Release Notes
2
2
  ===============================
3
3
 
4
- Rails 2.2 delivers a number of new and improved features. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/master) in the main Rails repository on GitHub.
4
+ Rails 2.2 delivers a number of new and improved features. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/2-2-stable) in the main Rails repository on GitHub.
5
5
 
6
6
  Along with Rails, 2.2 marks the launch of the [Ruby on Rails Guides](http://guides.rubyonrails.org/), the first results of the ongoing [Rails Guides hackfest](http://hackfest.rubyonrails.org/guide). This site will deliver high-quality documentation of the major features of Rails.
7
7
 
@@ -1,14 +1,14 @@
1
1
  Ruby on Rails 2.3 Release Notes
2
2
  ===============================
3
3
 
4
- Rails 2.3 delivers a variety of new and improved features, including pervasive Rack integration, refreshed support for Rails Engines, nested transactions for Active Record, dynamic and default scopes, unified rendering, more efficient routing, application templates, and quiet backtraces. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/master) in the main Rails repository on GitHub or review the `CHANGELOG` files for the individual Rails components.
4
+ Rails 2.3 delivers a variety of new and improved features, including pervasive Rack integration, refreshed support for Rails Engines, nested transactions for Active Record, dynamic and default scopes, unified rendering, more efficient routing, application templates, and quiet backtraces. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/2-3-stable) in the main Rails repository on GitHub or review the `CHANGELOG` files for the individual Rails components.
5
5
 
6
6
  --------------------------------------------------------------------------------
7
7
 
8
8
  Application Architecture
9
9
  ------------------------
10
10
 
11
- There are two major changes in the architecture of Rails applications: complete integration of the [Rack](http://rack.rubyforge.org/) modular web server interface, and renewed support for Rails Engines.
11
+ There are two major changes in the architecture of Rails applications: complete integration of the [Rack](http://rack.github.io/) modular web server interface, and renewed support for Rails Engines.
12
12
 
13
13
  ### Rack Integration
14
14
 
@@ -594,7 +594,7 @@ The internals of the various <code>rake gem</code> tasks have been substantially
594
594
  * Various files in /public that deal with CGI and FCGI dispatching are no longer generated in every Rails application by default (you can still get them if you need them by adding `--with-dispatchers` when you run the `rails` command, or add them later with `rake rails:update:generate_dispatchers`).
595
595
  * Rails Guides have been converted from AsciiDoc to Textile markup.
596
596
  * Scaffolded views and controllers have been cleaned up a bit.
597
- * `script/server` now accepts a <tt>--path</tt> argument to mount a Rails application from a specific path.
597
+ * `script/server` now accepts a `--path` argument to mount a Rails application from a specific path.
598
598
  * If any configured gems are missing, the gem rake tasks will skip loading much of the environment. This should solve many of the "chicken-and-egg" problems where rake gems:install couldn't run because gems were missing.
599
599
  * Gems are now unpacked exactly once. This fixes issues with gems (hoe, for instance) which are packed with read-only permissions on the files.
600
600
 
@@ -618,4 +618,4 @@ A few pieces of older code are deprecated in this release:
618
618
  Credits
619
619
  -------
620
620
 
621
- Release notes compiled by [Mike Gunderloy](http://afreshcup.com.) This version of the Rails 2.3 release notes was compiled based on RC2 of Rails 2.3.
621
+ Release notes compiled by [Mike Gunderloy](http://afreshcup.com). This version of the Rails 2.3 release notes was compiled based on RC2 of Rails 2.3.
@@ -15,7 +15,7 @@ Even if you don't give a hoot about any of our internal cleanups, Rails 3.0 is g
15
15
 
16
16
  On top of all that, we've tried our best to deprecate the old APIs with nice warnings. That means that you can move your existing application to Rails 3 without immediately rewriting all your old code to the latest best practices.
17
17
 
18
- These release notes cover the major upgrades, but don't include every little bug fix and change. Rails 3.0 consists of almost 4,000 commits by more than 250 authors! If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/master) in the main Rails repository on GitHub.
18
+ These release notes cover the major upgrades, but don't include every little bug fix and change. Rails 3.0 consists of almost 4,000 commits by more than 250 authors! If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/3-0-stable) in the main Rails repository on GitHub.
19
19
 
20
20
  --------------------------------------------------------------------------------
21
21
 
@@ -138,7 +138,7 @@ More Information: - [Rails Edge Architecture](http://yehudakatz.com/2009/06/11/r
138
138
 
139
139
  [Arel](http://github.com/brynary/arel) (or Active Relation) has been taken on as the underpinnings of Active Record and is now required for Rails. Arel provides an SQL abstraction that simplifies out Active Record and provides the underpinnings for the relation functionality in Active Record.
140
140
 
141
- More information: - [Why I wrote Arel](http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel/.)
141
+ More information: - [Why I wrote Arel](https://web.archive.org/web/20120718093140/http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel/)
142
142
 
143
143
 
144
144
  ### Mail Extraction
@@ -294,11 +294,11 @@ NOTE. The old style `map` commands still work as before with a backwards compati
294
294
  Deprecations
295
295
 
296
296
  * The catch all route for non-REST applications (`/:controller/:action/:id`) is now commented out.
297
- * Routes :path\_prefix no longer exists and :name\_prefix now automatically adds "\_" at the end of the given value.
297
+ * Routes `:path_prefix` no longer exists and `:name_prefix` now automatically adds "_" at the end of the given value.
298
298
 
299
299
  More Information:
300
300
  * [The Rails 3 Router: Rack it Up](http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/)
301
- * [Revamped Routes in Rails 3](http://rizwanreza.com/2009/12/20/revamped-routes-in-rails-3)
301
+ * [Revamped Routes in Rails 3](https://medium.com/fusion-of-thoughts/revamped-routes-in-rails-3-b6d00654e5b0)
302
302
  * [Generic Actions in Rails 3](http://yehudakatz.com/2009/12/20/generic-actions-in-rails-3/)
303
303
 
304
304
 
@@ -308,7 +308,7 @@ More Information:
308
308
 
309
309
  Major re-write was done in the Action View helpers, implementing Unobtrusive JavaScript (UJS) hooks and removing the old inline AJAX commands. This enables Rails to use any compliant UJS driver to implement the UJS hooks in the helpers.
310
310
 
311
- What this means is that all previous `remote_<method>` helpers have been removed from Rails core and put into the [Prototype Legacy Helper](http://github.com/rails/prototype_legacy_helper.) To get UJS hooks into your HTML, you now pass `:remote => true` instead. For example:
311
+ What this means is that all previous `remote_<method>` helpers have been removed from Rails core and put into the [Prototype Legacy Helper](http://github.com/rails/prototype_legacy_helper). To get UJS hooks into your HTML, you now pass `:remote => true` instead. For example:
312
312
 
313
313
  ```ruby
314
314
  form_for @post, :remote => true
@@ -521,7 +521,7 @@ A large effort was made in Active Support to make it cherry pickable, that is, y
521
521
  These are the main changes in Active Support:
522
522
 
523
523
  * Large clean up of the library removing unused methods throughout.
524
- * Active Support no longer provides vendored versions of [TZInfo](http://tzinfo.rubyforge.org/), [Memcache Client](http://deveiate.org/projects/RMemCache/) and [Builder](http://builder.rubyforge.org/,) these are all included as dependencies and installed via the `bundle install` command.
524
+ * Active Support no longer provides vendored versions of TZInfo, Memcache Client and Builder. These are all included as dependencies and installed via the `bundle install` command.
525
525
  * Safe buffers are implemented in `ActiveSupport::SafeBuffer`.
526
526
  * Added `Array.uniq_by` and `Array.uniq_by!`.
527
527
  * Removed `Array#rand` and backported `Array#sample` from Ruby 1.9.
@@ -545,7 +545,7 @@ These are the main changes in Active Support:
545
545
  * `String#to_time` and `String#to_datetime` handle fractional seconds.
546
546
  * Added support to new callbacks for around filter object that respond to `:before` and `:after` used in before and after callbacks.
547
547
  * The `ActiveSupport::OrderedHash#to_a` method returns an ordered set of arrays. Matches Ruby 1.9's `Hash#to_a`.
548
- * `MissingSourceFile` exists as a constant but it is now just equals to `LoadError`.
548
+ * `MissingSourceFile` exists as a constant but it is now just equal to `LoadError`.
549
549
  * Added `Class#class_attribute`, to be able to declare a class-level attribute whose value is inheritable and overwritable by subclasses.
550
550
  * Finally removed `DeprecatedCallbacks` in `ActiveRecord::Associations`.
551
551
  * `Object#metaclass` is now `Kernel#singleton_class` to match Ruby.
@@ -608,4 +608,4 @@ Credits
608
608
 
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
- Rails 3.0 Release Notes were compiled by [Mikel Lindsaar](http://lindsaar.net.)
611
+ Rails 3.0 Release Notes were compiled by [Mikel Lindsaar](http://lindsaar.net).
@@ -8,7 +8,10 @@ Highlights in Rails 3.1:
8
8
  * Assets Pipeline
9
9
  * jQuery as the default JavaScript library
10
10
 
11
- This release notes cover the major changes, but don't include every little bug fix and change. If you want to see everything, check out the [list of commits](https://github.com/rails/rails/commits/master) in the main Rails repository on GitHub.
11
+ These release notes cover only the major changes. To learn about various bug
12
+ fixes and changes, please refer to the change logs or check out the [list of
13
+ commits](https://github.com/rails/rails/commits/3-1-stable) in the main Rails
14
+ repository on GitHub.
12
15
 
13
16
  --------------------------------------------------------------------------------
14
17
 
@@ -173,7 +176,7 @@ The assets pipeline is powered by [Sprockets](https://github.com/sstephenson/spr
173
176
 
174
177
  ### HTTP Streaming
175
178
 
176
- HTTP Streaming is another change that is new in Rails 3.1. This lets the browser download your stylesheets and JavaScript files while the server is still generating the response. This requires Ruby 1.9.2, is opt-in and requires support from the web server as well, but the popular combo of nginx and unicorn is ready to take advantage of it.
179
+ HTTP Streaming is another change that is new in Rails 3.1. This lets the browser download your stylesheets and JavaScript files while the server is still generating the response. This requires Ruby 1.9.2, is opt-in and requires support from the web server as well, but the popular combo of NGINX and Unicorn is ready to take advantage of it.
177
180
 
178
181
  ### Default JS library is now jQuery
179
182
 
@@ -8,7 +8,10 @@ Highlights in Rails 3.2:
8
8
  * Automatic Query Explains
9
9
  * Tagged Logging
10
10
 
11
- These release notes cover the major changes, but do not include each bug-fix and changes. If you want to see everything, check out the [list of commits](https://github.com/rails/rails/commits/3-2-stable) in the main Rails repository on GitHub.
11
+ These release notes cover only the major changes. To learn about various bug
12
+ fixes and changes, please refer to the change logs or check out the [list of
13
+ commits](https://github.com/rails/rails/commits/3-2-stable) in the main Rails
14
+ repository on GitHub.
12
15
 
13
16
  --------------------------------------------------------------------------------
14
17
 
@@ -187,7 +190,7 @@ Action Pack
187
190
 
188
191
  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
192
 
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}`.
193
+ * `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
194
 
192
195
  * `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
196
 
@@ -562,4 +565,4 @@ Credits
562
565
 
563
566
  See the [full list of contributors to Rails](http://contributors.rubyonrails.org/) for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.
564
567
 
565
- Rails 3.2 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev.)
568
+ Rails 3.2 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev).
@@ -8,7 +8,10 @@ Highlights in Rails 4.0:
8
8
  * Turbolinks
9
9
  * Russian Doll Caching
10
10
 
11
- These release notes cover only the major changes. To know about various bug fixes and changes, please refer to the change logs or check out the [list of commits](https://github.com/rails/rails/commits/master) in the main Rails repository on GitHub.
11
+ These release notes cover only the major changes. To learn about various bug
12
+ fixes and changes, please refer to the change logs or check out the [list of
13
+ commits](https://github.com/rails/rails/commits/4-0-stable) in the main Rails
14
+ repository on GitHub.
12
15
 
13
16
  --------------------------------------------------------------------------------
14
17
 
@@ -226,11 +229,11 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/a
226
229
  The method `change_table` is also reversible, as long as its block doesn't call `remove`, `change` or `change_default`
227
230
 
228
231
  * New method `reversible` makes it possible to specify code to be run when migrating up or down.
229
- See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/migrations.md#using-the-reversible-method)
232
+ See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/active_record_migrations.md#using-reversible)
230
233
 
231
234
  * New method `revert` will revert a whole migration or the given block.
232
235
  If migrating down, the given migration / block is run normally.
233
- See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/migrations.md#reverting-previous-migrations)
236
+ See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/active_record_migrations.md#reverting-previous-migrations)
234
237
 
235
238
  * Adds PostgreSQL array type support. Any datatype can be used to create an array column, with full migration and schema dumper support.
236
239
 
@@ -8,10 +8,10 @@ Highlights in Rails 4.1:
8
8
  * Action Pack variants
9
9
  * Action Mailer previews
10
10
 
11
- These release notes cover only the major changes. To know about various bug
12
- fixes and changes, please refer to the change logs or check out the
13
- [list of commits](https://github.com/rails/rails/commits/master) in the main
14
- Rails repository on GitHub.
11
+ These release notes cover only the major changes. To learn about various bug
12
+ fixes and changes, please refer to the change logs or check out the [list of
13
+ commits](https://github.com/rails/rails/commits/4-1-stable) in the main Rails
14
+ repository on GitHub.
15
15
 
16
16
  --------------------------------------------------------------------------------
17
17
 
@@ -136,7 +136,7 @@ end
136
136
 
137
137
  ### Action Mailer Previews
138
138
 
139
- Action Mailer previews provide a way to visually see how emails look by visiting
139
+ Action Mailer previews provide a way to see how emails look by visiting
140
140
  a special URL that renders them.
141
141
 
142
142
  You implement a preview class whose methods return the mail object you'd like
@@ -157,7 +157,7 @@ By default, these preview classes live in `test/mailers/previews`.
157
157
  This can be configured using the `preview_path` option.
158
158
 
159
159
  See its
160
- [documentation](http://api.rubyonrails.org/v4.1.0/classes/ActionMailer/Base.html)
160
+ [documentation](http://api.rubyonrails.org/v4.1.0/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Previewing+emails)
161
161
  for a detailed write up.
162
162
 
163
163
  ### Active Record enums
@@ -396,7 +396,7 @@ for detailed changes.
396
396
  * Removed deprecated `scope` use without passing a callable object.
397
397
 
398
398
  * Removed deprecated `transaction_joinable=` in favor of `begin_transaction`
399
- with `d:joinable` option.
399
+ with a `:joinable` option.
400
400
 
401
401
  * Removed deprecated `decrement_open_transactions`.
402
402
 
@@ -465,10 +465,10 @@ for detailed changes.
465
465
 
466
466
  ### Notable changes
467
467
 
468
- * Default scopes are no longer overriden by chained conditions.
468
+ * Default scopes are no longer overridden by chained conditions.
469
469
 
470
470
  Before this change when you defined a `default_scope` in a model
471
- it was overriden by chained conditions in the same field. Now it
471
+ it was overridden by chained conditions in the same field. Now it
472
472
  is merged like any other scope. [More Details](upgrading_ruby_on_rails.html#changes-on-default-scopes).
473
473
 
474
474
  * Added `ActiveRecord::Base.to_param` for convenient "pretty" URLs derived from
@@ -555,13 +555,12 @@ for detailed changes.
555
555
  ([Pull Request](https://github.com/rails/rails/pull/13350))
556
556
 
557
557
  * Make `change_column_null`
558
- revertable. ([Commit](https://github.com/rails/rails/commit/724509a9d5322ff502aefa90dd282ba33a281a96))
558
+ revertible. ([Commit](https://github.com/rails/rails/commit/724509a9d5322ff502aefa90dd282ba33a281a96))
559
559
 
560
560
  * Added a flag to disable schema dump after migration. This is set to `false`
561
561
  by default in the production environment for new applications.
562
562
  ([Pull Request](https://github.com/rails/rails/pull/13948))
563
563
 
564
-
565
564
  Active Model
566
565
  ------------
567
566