rails 4.1.4 → 4.2.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +12 -10
- data/guides/CHANGELOG.md +87 -15
- data/guides/Rakefile +21 -6
- data/guides/assets/images/getting_started/article_with_comments.png +0 -0
- data/guides/assets/javascripts/guides.js +6 -0
- data/guides/assets/stylesheets/main.css +4 -1
- data/guides/bug_report_templates/action_controller_gem.rb +3 -3
- data/guides/bug_report_templates/action_controller_master.rb +3 -2
- data/guides/bug_report_templates/active_record_gem.rb +1 -1
- data/guides/bug_report_templates/generic_gem.rb +15 -0
- data/guides/bug_report_templates/generic_master.rb +26 -0
- data/guides/rails_guides/helpers.rb +1 -1
- data/guides/rails_guides/levenshtein.rb +27 -21
- data/guides/rails_guides/markdown/renderer.rb +1 -1
- data/guides/rails_guides/markdown.rb +11 -7
- data/guides/rails_guides.rb +2 -2
- data/guides/source/2_2_release_notes.md +1 -1
- data/guides/source/2_3_release_notes.md +4 -4
- data/guides/source/3_0_release_notes.md +8 -8
- data/guides/source/3_1_release_notes.md +6 -3
- data/guides/source/3_2_release_notes.md +6 -3
- data/guides/source/4_0_release_notes.md +6 -3
- data/guides/source/4_1_release_notes.md +10 -11
- data/guides/source/4_2_release_notes.md +877 -0
- data/guides/source/_license.html.erb +1 -1
- data/guides/source/_welcome.html.erb +6 -8
- data/guides/source/action_controller_overview.md +28 -11
- data/guides/source/action_mailer_basics.md +97 -29
- data/guides/source/action_view_overview.md +142 -191
- data/guides/source/active_job_basics.md +339 -0
- data/guides/source/active_model_basics.md +371 -17
- data/guides/source/active_record_basics.md +25 -24
- data/guides/source/active_record_callbacks.md +12 -9
- data/guides/source/{migrations.md → active_record_migrations.md} +135 -226
- data/guides/source/active_record_postgresql.md +433 -0
- data/guides/source/active_record_querying.md +270 -262
- data/guides/source/active_record_validations.md +24 -14
- data/guides/source/active_support_core_extensions.md +115 -123
- data/guides/source/active_support_instrumentation.md +10 -18
- data/guides/source/api_documentation_guidelines.md +63 -17
- data/guides/source/asset_pipeline.md +266 -125
- data/guides/source/association_basics.md +96 -80
- data/guides/source/autoloading_and_reloading_constants.md +1311 -0
- data/guides/source/caching_with_rails.md +32 -7
- data/guides/source/command_line.md +52 -30
- data/guides/source/configuring.md +161 -33
- data/guides/source/contributing_to_ruby_on_rails.md +198 -114
- data/guides/source/credits.html.erb +2 -2
- data/guides/source/debugging_rails_applications.md +448 -294
- data/guides/source/development_dependencies_install.md +47 -36
- data/guides/source/documents.yaml +19 -7
- data/guides/source/engines.md +217 -196
- data/guides/source/form_helpers.md +79 -56
- data/guides/source/generators.md +24 -11
- data/guides/source/getting_started.md +361 -222
- data/guides/source/i18n.md +113 -69
- data/guides/source/index.html.erb +1 -0
- data/guides/source/initialization.md +110 -63
- data/guides/source/layout.html.erb +5 -11
- data/guides/source/layouts_and_rendering.md +26 -26
- data/guides/source/maintenance_policy.md +26 -4
- data/guides/source/nested_model_forms.md +7 -4
- data/guides/source/plugins.md +27 -27
- data/guides/source/rails_application_templates.md +21 -3
- data/guides/source/rails_on_rack.md +12 -10
- data/guides/source/routing.md +115 -75
- data/guides/source/ruby_on_rails_guides_guidelines.md +11 -12
- data/guides/source/security.md +41 -35
- data/guides/source/testing.md +199 -119
- data/guides/source/upgrading_ruby_on_rails.md +319 -32
- data/guides/source/working_with_javascript_in_rails.md +19 -17
- data/guides/w3c_validator.rb +2 -0
- metadata +42 -95
- data/guides/code/getting_started/Gemfile +0 -40
- data/guides/code/getting_started/Gemfile.lock +0 -125
- data/guides/code/getting_started/README.rdoc +0 -28
- data/guides/code/getting_started/Rakefile +0 -6
- data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
- data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
- data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -23
- data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -53
- data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
- data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
- data/guides/code/getting_started/app/models/comment.rb +0 -3
- data/guides/code/getting_started/app/models/post.rb +0 -7
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
- data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
- data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
- data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
- data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
- data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
- data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
- data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
- data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -4
- data/guides/code/getting_started/bin/bundle +0 -4
- data/guides/code/getting_started/bin/rails +0 -4
- data/guides/code/getting_started/bin/rake +0 -4
- data/guides/code/getting_started/config/application.rb +0 -18
- data/guides/code/getting_started/config/boot.rb +0 -4
- data/guides/code/getting_started/config/database.yml +0 -25
- data/guides/code/getting_started/config/environment.rb +0 -5
- data/guides/code/getting_started/config/environments/development.rb +0 -30
- data/guides/code/getting_started/config/environments/production.rb +0 -80
- data/guides/code/getting_started/config/environments/test.rb +0 -36
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
- data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
- data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
- data/guides/code/getting_started/config/initializers/locale.rb +0 -9
- data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
- data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
- data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
- data/guides/code/getting_started/config/locales/en.yml +0 -23
- data/guides/code/getting_started/config/routes.rb +0 -7
- data/guides/code/getting_started/config.ru +0 -4
- data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
- data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
- data/guides/code/getting_started/db/schema.rb +0 -33
- data/guides/code/getting_started/db/seeds.rb +0 -7
- data/guides/code/getting_started/public/404.html +0 -60
- data/guides/code/getting_started/public/422.html +0 -60
- data/guides/code/getting_started/public/500.html +0 -59
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +0 -5
- data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
- data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
- data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
- data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
- data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
- data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
- data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
- data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
- data/guides/code/getting_started/test/models/comment_test.rb +0 -7
- data/guides/code/getting_started/test/models/post_test.rb +0 -7
- data/guides/code/getting_started/test/test_helper.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d4073c294efe444213b93605bd058bdfcfe7fd21df0673d411aaacb8444d6311
|
4
|
+
data.tar.gz: 6ced0776f690d103fd1ae235809fe9244f59538b6153c5f75247e76a35c9f600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e399f8b1df884ceb451de70d9e0a821f1a0c4621eb7ee8af0e9fdc1a955661aab731e6b9a7b3928f09d2a86d492ec737f5c488709d2ba734cbb9a42a1ef5e829
|
7
|
+
data.tar.gz: d302ab1709953482477f8ca896e45e54d69c8dcc16edf1f49e09ce1c8b451d0a1725baf3d3c7a2b138b97ca0018813e2cf907db01768188a8a025e68c4679b16
|
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
|
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.
|
17
|
-
|
18
|
-
|
19
|
-
in its [README](
|
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;
|
40
|
-
|
41
|
-
|
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://
|
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.
|
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,113 @@
|
|
1
|
-
## Rails 4.
|
1
|
+
## Rails 4.2.11.3 (May 15, 2020) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails 4.
|
6
|
+
## Rails 4.2.11.2 (May 15, 2020) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails 4.1
|
11
|
+
## Rails 4.2.11.1 (March 11, 2019) ##
|
12
12
|
|
13
|
-
*
|
13
|
+
* No changes.
|
14
14
|
|
15
|
-
*John Kelly Ferguson*
|
16
15
|
|
17
|
-
|
16
|
+
## Rails 4.2.11 (November 27, 2018) ##
|
18
17
|
|
19
|
-
|
18
|
+
* No changes.
|
19
|
+
|
20
|
+
|
21
|
+
## Rails 4.2.10 (September 27, 2017) ##
|
22
|
+
|
23
|
+
* No changes.
|
24
|
+
|
25
|
+
|
26
|
+
## Rails 4.2.9 (June 26, 2017) ##
|
27
|
+
|
28
|
+
* No changes.
|
29
|
+
|
30
|
+
|
31
|
+
## Rails 4.2.8 (February 21, 2017) ##
|
32
|
+
|
33
|
+
* No changes.
|
34
|
+
|
35
|
+
|
36
|
+
## Rails 4.2.7 (July 12, 2016) ##
|
37
|
+
|
38
|
+
* No changes.
|
20
39
|
|
21
40
|
|
22
|
-
## Rails 4.
|
41
|
+
## Rails 4.2.6 (March 07, 2016) ##
|
23
42
|
|
24
43
|
* No changes.
|
25
44
|
|
26
45
|
|
27
|
-
## Rails 4.
|
46
|
+
## Rails 4.2.5.2 (February 26, 2016) ##
|
47
|
+
|
48
|
+
* No changes.
|
28
49
|
|
29
|
-
* Fixed missing line and shadow on service pages(404, 422, 500).
|
30
50
|
|
31
|
-
|
51
|
+
## Rails 4.2.5.1 (January 25, 2016) ##
|
52
|
+
|
53
|
+
* No changes.
|
54
|
+
|
55
|
+
|
56
|
+
## Rails 4.2.5 (November 12, 2015) ##
|
57
|
+
|
58
|
+
* No changes.
|
59
|
+
|
32
60
|
|
33
|
-
|
61
|
+
## Rails 4.2.4 (August 24, 2015) ##
|
34
62
|
|
35
|
-
|
63
|
+
* No Changes *
|
36
64
|
|
37
|
-
|
65
|
+
|
66
|
+
## Rails 4.2.3 (June 25, 2015) ##
|
67
|
+
|
68
|
+
* No Changes *
|
69
|
+
|
70
|
+
|
71
|
+
## Rails 4.2.2 (June 16, 2015) ##
|
72
|
+
|
73
|
+
* No Changes *
|
74
|
+
|
75
|
+
|
76
|
+
## Rails 4.2.1 (March 19, 2015) ##
|
77
|
+
|
78
|
+
* No changes.
|
79
|
+
|
80
|
+
|
81
|
+
## Rails 4.2.0 (December 20, 2014) ##
|
82
|
+
|
83
|
+
* New guide about constant autoloading and reloading.
|
84
|
+
|
85
|
+
*Xavier Noria*
|
86
|
+
|
87
|
+
* Change Posts to Articles in Getting Started sample application in order to
|
88
|
+
better align with the actual guides.
|
89
|
+
|
90
|
+
*John Kelly Ferguson*
|
91
|
+
|
92
|
+
* Update all Rails 4.1.0 references to 4.1.1 within the guides and code.
|
93
|
+
|
94
|
+
*John Kelly Ferguson*
|
95
|
+
|
96
|
+
* Split up rows in the Explain Queries table of the ActiveRecord Querying section
|
97
|
+
in order to improve readability.
|
98
|
+
|
99
|
+
*John Kelly Ferguson*
|
100
|
+
|
101
|
+
* Change all non-HTTP method 'post' references to 'article'.
|
102
|
+
|
103
|
+
*John Kelly Ferguson*
|
104
|
+
|
105
|
+
* Updates the maintenance policy to match the latest versions of Rails
|
38
106
|
|
39
107
|
*Matias Korhonen*
|
40
108
|
|
41
|
-
|
109
|
+
* Switched the order of `Applying a default scope` and `Merging of scopes` subsections so default scopes are introduced first.
|
110
|
+
|
111
|
+
*Alex Riabov*
|
112
|
+
|
113
|
+
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
|
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]}
|
Binary file
|
@@ -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%
|
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.
|
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
|
-
|
11
|
-
|
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
|
-
|
20
|
-
|
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
|
@@ -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 =
|
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
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
n =
|
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
|
-
|
11
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
28
|
-
return d[m][n]
|
34
|
+
return x
|
29
35
|
end
|
30
36
|
end
|
31
37
|
end
|
@@ -47,8 +47,12 @@ module RailsGuides
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def dom_id_text(text)
|
50
|
-
|
51
|
-
|
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.
|
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"
|
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
|
data/guides/rails_guides.rb
CHANGED
@@ -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
|
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', '~>
|
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/
|
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/
|
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.
|
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
|
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.
|
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/
|
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
|
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](
|
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.
|
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
|
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
|
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).
|