rails 4.1.6 → 4.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +12 -10
  3. data/guides/CHANGELOG.md +64 -17
  4. data/guides/Rakefile +21 -6
  5. data/guides/assets/images/getting_started/article_with_comments.png +0 -0
  6. data/guides/assets/javascripts/guides.js +6 -0
  7. data/guides/assets/stylesheets/main.css +4 -1
  8. data/guides/bug_report_templates/action_controller_gem.rb +3 -3
  9. data/guides/bug_report_templates/action_controller_master.rb +3 -2
  10. data/guides/bug_report_templates/active_record_gem.rb +1 -1
  11. data/guides/bug_report_templates/generic_gem.rb +15 -0
  12. data/guides/bug_report_templates/generic_master.rb +26 -0
  13. data/guides/rails_guides/helpers.rb +1 -1
  14. data/guides/rails_guides/levenshtein.rb +27 -21
  15. data/guides/rails_guides/markdown/renderer.rb +1 -1
  16. data/guides/rails_guides/markdown.rb +11 -7
  17. data/guides/rails_guides.rb +2 -2
  18. data/guides/source/2_2_release_notes.md +1 -1
  19. data/guides/source/2_3_release_notes.md +4 -4
  20. data/guides/source/3_0_release_notes.md +8 -8
  21. data/guides/source/3_1_release_notes.md +6 -3
  22. data/guides/source/3_2_release_notes.md +6 -3
  23. data/guides/source/4_0_release_notes.md +6 -3
  24. data/guides/source/4_1_release_notes.md +9 -10
  25. data/guides/source/4_2_release_notes.md +877 -0
  26. data/guides/source/_license.html.erb +1 -1
  27. data/guides/source/_welcome.html.erb +6 -8
  28. data/guides/source/action_controller_overview.md +25 -8
  29. data/guides/source/action_mailer_basics.md +97 -29
  30. data/guides/source/action_view_overview.md +142 -191
  31. data/guides/source/active_job_basics.md +339 -0
  32. data/guides/source/active_model_basics.md +371 -17
  33. data/guides/source/active_record_basics.md +25 -24
  34. data/guides/source/active_record_callbacks.md +12 -9
  35. data/guides/source/{migrations.md → active_record_migrations.md} +95 -220
  36. data/guides/source/active_record_postgresql.md +433 -0
  37. data/guides/source/active_record_querying.md +264 -268
  38. data/guides/source/active_record_validations.md +23 -13
  39. data/guides/source/active_support_core_extensions.md +115 -123
  40. data/guides/source/active_support_instrumentation.md +10 -18
  41. data/guides/source/api_documentation_guidelines.md +63 -17
  42. data/guides/source/asset_pipeline.md +259 -120
  43. data/guides/source/association_basics.md +96 -80
  44. data/guides/source/autoloading_and_reloading_constants.md +1311 -0
  45. data/guides/source/caching_with_rails.md +32 -7
  46. data/guides/source/command_line.md +52 -30
  47. data/guides/source/configuring.md +161 -33
  48. data/guides/source/contributing_to_ruby_on_rails.md +198 -114
  49. data/guides/source/credits.html.erb +2 -2
  50. data/guides/source/debugging_rails_applications.md +440 -286
  51. data/guides/source/development_dependencies_install.md +47 -36
  52. data/guides/source/documents.yaml +19 -7
  53. data/guides/source/engines.md +217 -196
  54. data/guides/source/form_helpers.md +79 -56
  55. data/guides/source/generators.md +24 -11
  56. data/guides/source/getting_started.md +359 -219
  57. data/guides/source/i18n.md +110 -66
  58. data/guides/source/index.html.erb +1 -0
  59. data/guides/source/initialization.md +109 -62
  60. data/guides/source/layout.html.erb +5 -11
  61. data/guides/source/layouts_and_rendering.md +26 -26
  62. data/guides/source/maintenance_policy.md +6 -3
  63. data/guides/source/nested_model_forms.md +7 -4
  64. data/guides/source/plugins.md +27 -27
  65. data/guides/source/rails_application_templates.md +21 -3
  66. data/guides/source/rails_on_rack.md +8 -5
  67. data/guides/source/routing.md +113 -73
  68. data/guides/source/ruby_on_rails_guides_guidelines.md +11 -12
  69. data/guides/source/security.md +40 -34
  70. data/guides/source/testing.md +199 -119
  71. data/guides/source/upgrading_ruby_on_rails.md +289 -31
  72. data/guides/source/working_with_javascript_in_rails.md +19 -17
  73. data/guides/w3c_validator.rb +2 -0
  74. metadata +42 -95
  75. data/guides/code/getting_started/Gemfile +0 -40
  76. data/guides/code/getting_started/Gemfile.lock +0 -125
  77. data/guides/code/getting_started/README.rdoc +0 -28
  78. data/guides/code/getting_started/Rakefile +0 -6
  79. data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
  80. data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
  81. data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
  82. data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
  83. data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
  84. data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
  85. data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
  86. data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
  87. data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
  88. data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -23
  89. data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -53
  90. data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
  91. data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
  92. data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
  93. data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
  94. data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
  95. data/guides/code/getting_started/app/models/comment.rb +0 -3
  96. data/guides/code/getting_started/app/models/post.rb +0 -7
  97. data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
  98. data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
  99. data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
  100. data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
  101. data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
  102. data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
  103. data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
  104. data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
  105. data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -4
  106. data/guides/code/getting_started/bin/bundle +0 -4
  107. data/guides/code/getting_started/bin/rails +0 -4
  108. data/guides/code/getting_started/bin/rake +0 -4
  109. data/guides/code/getting_started/config/application.rb +0 -18
  110. data/guides/code/getting_started/config/boot.rb +0 -4
  111. data/guides/code/getting_started/config/database.yml +0 -25
  112. data/guides/code/getting_started/config/environment.rb +0 -5
  113. data/guides/code/getting_started/config/environments/development.rb +0 -30
  114. data/guides/code/getting_started/config/environments/production.rb +0 -80
  115. data/guides/code/getting_started/config/environments/test.rb +0 -36
  116. data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
  117. data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
  118. data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
  119. data/guides/code/getting_started/config/initializers/locale.rb +0 -9
  120. data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
  121. data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
  122. data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
  123. data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
  124. data/guides/code/getting_started/config/locales/en.yml +0 -23
  125. data/guides/code/getting_started/config/routes.rb +0 -7
  126. data/guides/code/getting_started/config.ru +0 -4
  127. data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
  128. data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
  129. data/guides/code/getting_started/db/schema.rb +0 -33
  130. data/guides/code/getting_started/db/seeds.rb +0 -7
  131. data/guides/code/getting_started/public/404.html +0 -60
  132. data/guides/code/getting_started/public/422.html +0 -60
  133. data/guides/code/getting_started/public/500.html +0 -59
  134. data/guides/code/getting_started/public/favicon.ico +0 -0
  135. data/guides/code/getting_started/public/robots.txt +0 -5
  136. data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
  137. data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
  138. data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
  139. data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
  140. data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
  141. data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
  142. data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
  143. data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
  144. data/guides/code/getting_started/test/models/comment_test.rb +0 -7
  145. data/guides/code/getting_started/test/models/post_test.rb +0 -7
  146. data/guides/code/getting_started/test/test_helper.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bef8d211ec9d2711afd4be1c75ad9d77cd349716
4
- data.tar.gz: dd6c6df885de72b7195634572cce8280837ed851
2
+ SHA256:
3
+ metadata.gz: ed511f57c4f4bf5d8805cb2863ce4b6f19fc654690e4e220b621aaaf77ae3e7e
4
+ data.tar.gz: 8fba02ec07b5c181bdb568eb3d8e1c5aea4c4c8109bf60095d256e1d55d1de35
5
5
  SHA512:
6
- metadata.gz: 0d1aaee5cde2bea7fbe6d6405d07f79673f267c5c0f797d4a2b8761a45b947b543cbbef3233c25b3ec7553f2ef35b22a50a949d882171c5094664a6728d8644a
7
- data.tar.gz: 7c1d7543824c34002432b7571096385c4c73e61478d1347caa131965e620ea40e9dde8f2d0c5bbb6a463eedcf6dcd2a6ac15053a0e1f96a9a9c3ac6af093c9b0
6
+ metadata.gz: 61b4563559452c9e56516223273bb198136fc8eb2c8a521ec16a986460eec39a4dae7c62c16aebae330ca2777045c804394fc2839570ea30775f208785442d30
7
+ data.tar.gz: e2abd4c6da1b6972e52cd824ec4fb525ce435703dbdb6c87596d4d60c99918559d49ab7226d1baa326c47c567fc0d606aa81df8c5e3666389ce4862d1da5e38d
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,51 +1,98 @@
1
- ## Rails 4.1.6 (September 11, 2014) ##
1
+ ## Rails 4.2.11 (November 27, 2018) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 4.1.5 (August 18, 2014) ##
6
+ ## Rails 4.2.10 (September 27, 2017) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 4.1.4 (July 2, 2014) ##
11
+ ## Rails 4.2.9 (June 26, 2017) ##
12
12
 
13
13
  * No changes.
14
14
 
15
15
 
16
- ## Rails 4.1.3 (July 2, 2014) ##
16
+ ## Rails 4.2.8 (February 21, 2017) ##
17
17
 
18
18
  * No changes.
19
19
 
20
20
 
21
- ## Rails 4.1.2 (June 26, 2014) ##
21
+ ## Rails 4.2.7 (July 12, 2016) ##
22
22
 
23
- * Update all Rails 4.1.0 references to 4.1.1 within the guides and code.
23
+ * No changes.
24
24
 
25
- *John Kelly Ferguson*
26
25
 
27
- * Updates the maintenance policy to match the latest versions of Rails.
26
+ ## Rails 4.2.6 (March 07, 2016) ##
27
+
28
+ * No changes.
29
+
30
+
31
+ ## Rails 4.2.5.2 (February 26, 2016) ##
32
+
33
+ * No changes.
28
34
 
29
- *Matias Korhonen*
30
35
 
36
+ ## Rails 4.2.5.1 (January 25, 2016) ##
31
37
 
32
- ## Rails 4.1.1 (May 6, 2014) ##
38
+ * No changes.
39
+
40
+
41
+ ## Rails 4.2.5 (November 12, 2015) ##
33
42
 
34
43
  * No changes.
35
44
 
36
45
 
37
- ## Rails 4.1.0 (April 8, 2014) ##
46
+ ## Rails 4.2.4 (August 24, 2015) ##
47
+
48
+ * No Changes *
49
+
38
50
 
39
- * Fixed missing line and shadow on service pages(404, 422, 500).
51
+ ## Rails 4.2.3 (June 25, 2015) ##
40
52
 
41
- *Dmitry Korotkov*
53
+ * No Changes *
42
54
 
43
- * Removed repetitive th tags. Instead of them added one th tag with a colspan attribute.
44
55
 
45
- *Sıtkı Bağdat*
56
+ ## Rails 4.2.2 (June 16, 2015) ##
57
+
58
+ * No Changes *
59
+
60
+
61
+ ## Rails 4.2.1 (March 19, 2015) ##
62
+
63
+ * No changes.
46
64
 
47
- * Added the Rails maintenance policy to the guides.
65
+
66
+ ## Rails 4.2.0 (December 20, 2014) ##
67
+
68
+ * New guide about constant autoloading and reloading.
69
+
70
+ *Xavier Noria*
71
+
72
+ * Change Posts to Articles in Getting Started sample application in order to
73
+ better align with the actual guides.
74
+
75
+ *John Kelly Ferguson*
76
+
77
+ * Update all Rails 4.1.0 references to 4.1.1 within the guides and code.
78
+
79
+ *John Kelly Ferguson*
80
+
81
+ * Split up rows in the Explain Queries table of the ActiveRecord Querying section
82
+ in order to improve readability.
83
+
84
+ *John Kelly Ferguson*
85
+
86
+ * Change all non-HTTP method 'post' references to 'article'.
87
+
88
+ *John Kelly Ferguson*
89
+
90
+ * Updates the maintenance policy to match the latest versions of Rails
48
91
 
49
92
  *Matias Korhonen*
50
93
 
51
- Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/guides/CHANGELOG.md) for previous changes.
94
+ * Switched the order of `Applying a default scope` and `Merging of scopes` subsections so default scopes are introduced first.
95
+
96
+ *Alex Riabov*
97
+
98
+ Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/guides/CHANGELOG.md) for previous changes.
data/guides/Rakefile CHANGED
@@ -3,18 +3,31 @@ namespace :guides do
3
3
  desc 'Generate guides (for authors), use ONLY=foo to process just "foo.md"'
4
4
  task :generate => 'generate:html'
5
5
 
6
+ # Guides are written in UTF-8, but the environment may be configured for some
7
+ # other locale, these tasks are responsible for ensuring the default external
8
+ # encoding is UTF-8.
9
+ #
10
+ # Real use cases: Generation was reported to fail on a machine configured with
11
+ # GBK (Chinese). The docs server once got misconfigured somehow and had "C",
12
+ # which broke generation too.
13
+ task :encoding do
14
+ %w(LANG LANGUAGE LC_ALL).each do |env_var|
15
+ ENV[env_var] = "en_US.UTF-8"
16
+ end
17
+ end
18
+
6
19
  namespace :generate do
7
20
 
8
21
  desc "Generate HTML guides"
9
- task :html do
22
+ task :html => :encoding do
10
23
  ENV["WARN_BROKEN_LINKS"] = "1" # authors can't disable this
11
24
  ruby "rails_guides.rb"
12
25
  end
13
26
 
14
27
  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
- task :kindle do
16
- unless `kindlerb -v 2> /dev/null` =~ /kindlerb 0.1.1/
17
- abort "Please `gem install kindlerb`"
28
+ task :kindle => :encoding do
29
+ unless `kindlerb -v 2> /dev/null` =~ /kindlerb 0.1.1/
30
+ abort "Please `gem install kindlerb` and make sure you have `kindlegen` in your PATH"
18
31
  end
19
32
  unless `convert` =~ /convert/
20
33
  abort "Please install ImageMagick`"
@@ -26,7 +39,7 @@ namespace :guides do
26
39
 
27
40
  # Validate guides -------------------------------------------------------------------------
28
41
  desc 'Validate guides, use ONLY=foo to process just "foo.html"'
29
- task :validate do
42
+ task :validate => :encoding do
30
43
  ruby "w3c_validator.rb"
31
44
  end
32
45
 
@@ -34,10 +47,12 @@ namespace :guides do
34
47
  task :help do
35
48
  puts <<-help
36
49
 
37
- Guides are taken from the source directory, and the resulting HTML goes into the
50
+ Guides are taken from the source directory, and the result goes into the
38
51
  output directory. Assets are stored under files, and copied to output/files as
39
52
  part of the generation process.
40
53
 
54
+ You can generate HTML, Kindle or both formats using the `guides:generate` task.
55
+
41
56
  All this process is handled via rake tasks, here's a full list of them:
42
57
 
43
58
  #{%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 {
@@ -1,5 +1,5 @@
1
1
  # Activate the gem you are reporting the issue against.
2
- gem 'rails', '4.0.0'
2
+ gem 'rails', '4.2.0'
3
3
 
4
4
  require 'rails'
5
5
  require 'action_controller/railtie'
@@ -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
@@ -1,5 +1,5 @@
1
1
  # Activate the gem you are reporting the issue against.
2
- gem 'activerecord', '4.0.0'
2
+ gem 'activerecord', '4.2.0'
3
3
  require 'active_record'
4
4
  require 'minitest/autorun'
5
5
  require 'logger'
@@ -0,0 +1,15 @@
1
+ # Activate the gems you are reporting the issue against.
2
+ gem 'activesupport', '4.2.0'
3
+ require 'active_support'
4
+ require 'active_support/core_ext/object/blank'
5
+ require 'minitest/autorun'
6
+
7
+ # Ensure backward compatibility with Minitest 4
8
+ Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
9
+
10
+ class BugTest < Minitest::Test
11
+ def test_stuff
12
+ assert "zomg".present?
13
+ refute "".present?
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ unless File.exist?('Gemfile')
2
+ File.write('Gemfile', <<-GEMFILE)
3
+ source 'https://rubygems.org'
4
+ gem 'rails', github: 'rails/rails'
5
+ gem 'arel', github: 'rails/arel'
6
+ GEMFILE
7
+
8
+ system 'bundle'
9
+ end
10
+
11
+ require 'bundler'
12
+ Bundler.setup(:default)
13
+
14
+ require 'active_support'
15
+ require 'active_support/core_ext/object/blank'
16
+ require 'minitest/autorun'
17
+
18
+ # Ensure backward compatibility with Minitest 4
19
+ Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
20
+
21
+ class BugTest < Minitest::Test
22
+ def test_stuff
23
+ assert "zomg".present?
24
+ refute "".present?
25
+ end
26
+ end
@@ -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,37 @@
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
9
10
 
10
- # matrix initialization
11
- d = []
12
- 0.upto(m) { |i| d << [i] }
13
- 0.upto(n) { |j| d[0][j] = j }
11
+ return m if (0 == n)
12
+ return n if (0 == m)
14
13
 
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
14
+ d = (0..m).to_a
15
+ x = nil
16
+
17
+ str1.each_char.each_with_index do |char1,i|
18
+ e = i+1
19
+
20
+ str2.each_char.each_with_index do |char2,j|
21
+ cost = (char1 == char2) ? 0 : 1
22
+ x = [
23
+ d[j+1] + 1, # insertion
24
+ e + 1, # deletion
25
+ d[j] + cost # substitution
26
+ ].min
27
+ d[j] = e
28
+ e = x
24
29
  end
30
+
31
+ d[m] = x
25
32
  end
26
33
 
27
- # all done
28
- return d[m][n]
34
+ return x
29
35
  end
30
36
  end
31
37
  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
 
@@ -169,11 +172,11 @@ Rails Architectural Changes
169
172
 
170
173
  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
174
 
172
- The assets pipeline is powered by [Sprockets](https://github.com/sstephenson/sprockets) and is covered in the [Asset Pipeline](asset_pipeline.html) guide.
175
+ The assets pipeline is powered by [Sprockets](https://github.com/rails/sprockets) and is covered in the [Asset Pipeline](asset_pipeline.html) guide.
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