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.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +12 -10
  3. data/guides/CHANGELOG.md +87 -15
  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 +10 -11
  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 +28 -11
  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} +135 -226
  36. data/guides/source/active_record_postgresql.md +433 -0
  37. data/guides/source/active_record_querying.md +270 -262
  38. data/guides/source/active_record_validations.md +24 -14
  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 +266 -125
  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 +448 -294
  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 +361 -222
  57. data/guides/source/i18n.md +113 -69
  58. data/guides/source/index.html.erb +1 -0
  59. data/guides/source/initialization.md +110 -63
  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 +26 -4
  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 +12 -10
  67. data/guides/source/routing.md +115 -75
  68. data/guides/source/ruby_on_rails_guides_guidelines.md +11 -12
  69. data/guides/source/security.md +41 -35
  70. data/guides/source/testing.md +199 -119
  71. data/guides/source/upgrading_ruby_on_rails.md +319 -32
  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
@@ -24,9 +24,9 @@ NOTE: Bugs in the most recent released version of Ruby on Rails are likely to ge
24
24
 
25
25
  ### Creating a Bug Report
26
26
 
27
- If you've found a problem in Ruby on Rails which is not a security risk, do a search in GitHub under [Issues](https://github.com/rails/rails/issues) in case it was already reported. If you find no issue addressing it you can [add a new one](https://github.com/rails/rails/issues/new). (See the next section for reporting security issues.)
27
+ If you've found a problem in Ruby on Rails which is not a security risk, do a search in GitHub under [Issues](https://github.com/rails/rails/issues) in case it has already been reported. If you do not find any issue addressing it you may proceed to [open a new one](https://github.com/rails/rails/issues/new). (See the next section for reporting security issues.)
28
28
 
29
- At the minimum, your issue report needs a title and descriptive text. But that's only a minimum. You should include as much relevant information as possible. You need at least to post the code sample that has the issue. Even better is to include a unit test that shows how the expected behavior is not occurring. Your goal should be to make it easy for yourself - and others - to replicate the bug and figure out a fix.
29
+ Your issue report should contain a title and a clear description of the issue at the bare minimum. You should include as much relevant information as possible and should at least post a code sample that demonstrates the issue. It would be even better if you could include a unit test that shows how the expected behavior is not occurring. Your goal should be to make it easy for yourself - and others - to replicate the bug and figure out a fix.
30
30
 
31
31
  Then, don't get your hopes up! Unless you have a "Code Red, Mission Critical, the World is Coming to an End" kind of bug, you're creating this issue report in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the issue report will automatically see any activity or that others will jump to fix it. Creating an issue like this is mostly to help yourself start on the path of fixing the problem and for others to confirm it with an "I'm having this problem too" comment.
32
32
 
@@ -50,7 +50,7 @@ Please don't put "feature request" items into GitHub Issues. If there's a new
50
50
  feature that you want to see added to Ruby on Rails, you'll need to write the
51
51
  code yourself - or convince someone else to partner with you to write the code.
52
52
  Later in this guide you'll find detailed instructions for proposing a patch to
53
- Ruby on Rails. If you enter a wishlist item in GitHub Issues with no code, you
53
+ Ruby on Rails. If you enter a wish list item in GitHub Issues with no code, you
54
54
  can expect it to be marked "invalid" as soon as it's reviewed.
55
55
 
56
56
  Sometimes, the line between 'bug' and 'feature' is a hard one to draw.
@@ -69,89 +69,6 @@ won't be accepted." But it's the proper place to discuss new ideas. GitHub
69
69
  Issues are not a particularly good venue for the sometimes long and involved
70
70
  discussions new features require.
71
71
 
72
- Setting Up a Development Environment
73
- ------------------------------------
74
-
75
- To move on from submitting bugs to helping resolve existing issues or contributing your own code to Ruby on Rails, you _must_ be able to run its test suite. In this section of the guide you'll learn how to set up the tests on your own computer.
76
-
77
- ### The Easy Way
78
-
79
- The easiest and recommended way to get a development environment ready to hack is to use the [Rails development box](https://github.com/rails/rails-dev-box).
80
-
81
- ### The Hard Way
82
-
83
- In case you can't use the Rails development box, see section above, check [this other guide](development_dependencies_install.html).
84
-
85
-
86
- Running an Application Against Your Local Branch
87
- ------------------------------------------------
88
-
89
- The `--dev` flag of `rails new` generates an application that uses your local
90
- branch:
91
-
92
- ```bash
93
- $ cd rails
94
- $ bundle exec rails new ~/my-test-app --dev
95
- ```
96
-
97
- The application generated in `~/my-test-app` runs against your local branch
98
- and in particular sees any modifications upon server reboot.
99
-
100
-
101
- Testing Active Record
102
- ---------------------
103
-
104
- This is how you run the Active Record test suite only for SQLite3:
105
-
106
- ```bash
107
- $ cd activerecord
108
- $ bundle exec rake test_sqlite3
109
- ```
110
-
111
- You can now run the tests as you did for `sqlite3`. The tasks are respectively
112
-
113
- ```bash
114
- test_mysql
115
- test_mysql2
116
- test_postgresql
117
- ```
118
-
119
- Finally,
120
-
121
- ```bash
122
- $ bundle exec rake test
123
- ```
124
-
125
- will now run the four of them in turn.
126
-
127
- You can also run any single test separately:
128
-
129
- ```bash
130
- $ ARCONN=sqlite3 ruby -Itest test/cases/associations/has_many_associations_test.rb
131
- ```
132
-
133
- You can invoke `test_jdbcmysql`, `test_jdbcsqlite3` or `test_jdbcpostgresql` also. See the file `activerecord/RUNNING_UNIT_TESTS.rdoc` for information on running more targeted database tests, or the file `ci/travis.rb` for the test suite run by the continuous integration server.
134
-
135
- ### Warnings
136
-
137
- The test suite runs with warnings enabled. Ideally, Ruby on Rails should issue no warnings, but there may be a few, as well as some from third-party libraries. Please ignore (or fix!) them, if any, and submit patches that do not issue new warnings.
138
-
139
- If you are sure about what you are doing and would like to have a more clear output, there's a way to override the flag:
140
-
141
- ```bash
142
- $ RUBYOPT=-W0 bundle exec rake test
143
- ```
144
-
145
- ### Older Versions of Ruby on Rails
146
-
147
- If you want to add a fix to older versions of Ruby on Rails, you'll need to set up and switch to your own local tracking branch. Here is an example to switch to the 3-0-stable branch:
148
-
149
- ```bash
150
- $ git branch --track 3-0-stable origin/3-0-stable
151
- $ git checkout 3-0-stable
152
- ```
153
-
154
- TIP: You may want to [put your Git branch name in your shell prompt](http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/) to make it easier to remember which version of the code you're working with.
155
72
 
156
73
  Helping to Resolve Existing Issues
157
74
  ----------------------------------
@@ -192,9 +109,7 @@ After applying their branch, test it out! Here are some things to think about:
192
109
 
193
110
  Once you're happy that the pull request contains a good change, comment on the GitHub issue indicating your approval. Your comment should indicate that you like the change and what you like about it. Something like:
194
111
 
195
- <blockquote>
196
- I like the way you've restructured that code in generate_finder_sql - much nicer. The tests look good too.
197
- </blockquote>
112
+ >I like the way you've restructured that code in generate_finder_sql - much nicer. The tests look good too.
198
113
 
199
114
  If your comment simply says "+1", then odds are that other reviewers aren't going to take it too seriously. Show that you took the time to review the pull request.
200
115
 
@@ -204,11 +119,11 @@ Contributing to the Rails Documentation
204
119
  Ruby on Rails has two main sets of documentation: the guides, which help you
205
120
  learn about Ruby on Rails, and the API, which serves as a reference.
206
121
 
207
- You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing it up to date with the latest edge Rails. To get involved in the translation of Rails guides, please see [Translating Rails Guides](https://wiki.github.com/rails/docrails/translating-rails-guides).
122
+ You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing it up to date with the latest edge Rails.
208
123
 
209
124
  You can either open a pull request to [Rails](http://github.com/rails/rails) or
210
125
  ask the [Rails core team](http://rubyonrails.org/core) for commit access on
211
- [docrails](http://github.com/rails/docrails) if you contribute regularly.
126
+ docrails if you contribute regularly.
212
127
  Please do not open pull requests in docrails, if you'd like to get feedback on your
213
128
  change, ask for it in [Rails](http://github.com/rails/rails) instead.
214
129
 
@@ -227,9 +142,21 @@ WARNING: Docrails has a very strict policy: no code can be touched whatsoever, n
227
142
  Contributing to the Rails Code
228
143
  ------------------------------
229
144
 
145
+ ### Setting Up a Development Environment
146
+
147
+ To move on from submitting bugs to helping resolve existing issues or contributing your own code to Ruby on Rails, you _must_ be able to run its test suite. In this section of the guide you'll learn how to setup the tests on your own computer.
148
+
149
+ #### The Easy Way
150
+
151
+ The easiest and recommended way to get a development environment ready to hack is to use the [Rails development box](https://github.com/rails/rails-dev-box).
152
+
153
+ #### The Hard Way
154
+
155
+ In case you can't use the Rails development box, see [this other guide](development_dependencies_install.html).
156
+
230
157
  ### Clone the Rails Repository
231
158
 
232
- The first thing you need to do to be able to contribute code is to clone the repository:
159
+ To be able to contribute code, you need to clone the Rails repository:
233
160
 
234
161
  ```bash
235
162
  $ git clone git://github.com/rails/rails.git
@@ -244,29 +171,31 @@ $ git checkout -b my_new_branch
244
171
 
245
172
  It doesn't matter much what name you use, because this branch will only exist on your local computer and your personal repository on GitHub. It won't be part of the Rails Git repository.
246
173
 
174
+ ### Running an Application Against Your Local Branch
175
+
176
+ In case you need a dummy Rails app to test changes, the `--dev` flag of `rails new` generates an application that uses your local branch:
177
+
178
+ ```bash
179
+ $ cd rails
180
+ $ bundle exec rails new ~/my-test-app --dev
181
+ ```
182
+
183
+ The application generated in `~/my-test-app` runs against your local branch
184
+ and in particular sees any modifications upon server reboot.
185
+
247
186
  ### Write Your Code
248
187
 
249
- Now get busy and add or edit code. You're on your branch now, so you can write whatever you want (you can check to make sure you're on the right branch with `git branch -a`). But if you're planning to submit your change back for inclusion in Rails, keep a few things in mind:
188
+ Now get busy and add/edit code. You're on your branch now, so you can write whatever you want (make sure you're on the right branch with `git branch -a`). But if you're planning to submit your change back for inclusion in Rails, keep a few things in mind:
250
189
 
251
190
  * Get the code right.
252
191
  * Use Rails idioms and helpers.
253
192
  * Include tests that fail without your code, and pass with it.
254
193
  * Update the (surrounding) documentation, examples elsewhere, and the guides: whatever is affected by your contribution.
255
194
 
256
- It is not customary in Rails to run the full test suite before pushing
257
- changes. The railties test suite in particular takes a long time, and even
258
- more if the source code is mounted in `/vagrant` as happens in the recommended
259
- workflow with the [rails-dev-box](https://github.com/rails/rails-dev-box).
260
-
261
- As a compromise, test what your code obviously affects, and if the change is
262
- not in railties, run the whole test suite of the affected component. If all
263
- tests are passing, that's enough to propose your contribution. We have
264
- [Travis CI](https://travis-ci.org/rails/rails) as a safety net for catching
265
- unexpected breakages elsewhere.
266
195
 
267
- TIP: Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of Rails will generally not be accepted.
196
+ TIP: Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of Rails will generally not be accepted (read more about [our rationales behind this decision](https://github.com/rails/rails/pull/13771#issuecomment-32746700)).
268
197
 
269
- ### Follow the Coding Conventions
198
+ #### Follow the Coding Conventions
270
199
 
271
200
  Rails follows a simple set of coding style conventions:
272
201
 
@@ -284,13 +213,136 @@ Rails follows a simple set of coding style conventions:
284
213
 
285
214
  The above are guidelines - please use your best judgment in using them.
286
215
 
216
+ ### Benchmark Your Code
217
+
218
+ If your change has an impact on the performance of Rails, please use the
219
+ [benchmark-ips](https://github.com/evanphx/benchmark-ips) gem to provide
220
+ benchmark results for comparison.
221
+
222
+ Here's an example of using benchmark-ips:
223
+
224
+ ```ruby
225
+ require 'benchmark/ips'
226
+
227
+ Benchmark.ips do |x|
228
+ x.report('addition') { 1 + 2 }
229
+ x.report('addition with send') { 1.send(:+, 2) }
230
+ end
231
+ ```
232
+
233
+ This will generate a report with the following information:
234
+
235
+ ```
236
+ Calculating -------------------------------------
237
+ addition 69114 i/100ms
238
+ addition with send 64062 i/100ms
239
+ -------------------------------------------------
240
+ addition 5307644.4 (±3.5%) i/s - 26539776 in 5.007219s
241
+ addition with send 3702897.9 (±3.5%) i/s - 18513918 in 5.006723s
242
+ ```
243
+
244
+ Please see the benchmark/ips [README](https://github.com/evanphx/benchmark-ips/blob/master/README.md) for more information.
245
+
246
+ ### Running Tests
247
+
248
+ It is not customary in Rails to run the full test suite before pushing
249
+ changes. The railties test suite in particular takes a long time, and even
250
+ more if the source code is mounted in `/vagrant` as happens in the recommended
251
+ workflow with the [rails-dev-box](https://github.com/rails/rails-dev-box).
252
+
253
+ As a compromise, test what your code obviously affects, and if the change is
254
+ not in railties, run the whole test suite of the affected component. If all
255
+ tests are passing, that's enough to propose your contribution. We have
256
+ [Travis CI](https://travis-ci.org/rails/rails) as a safety net for catching
257
+ unexpected breakages elsewhere.
258
+
259
+ #### Entire Rails:
260
+
261
+ To run all the tests, do:
262
+
263
+ ```bash
264
+ $ cd rails
265
+ $ bundle exec rake test
266
+ ```
267
+
268
+ #### For a Particular Component
269
+
270
+ You can run tests only for a particular component (e.g. Action Pack). For example,
271
+ to run Action Mailer tests:
272
+
273
+ ```bash
274
+ $ cd actionmailer
275
+ $ bundle exec rake test
276
+ ```
277
+
278
+ #### Running a Single Test
279
+
280
+ You can run a single test through ruby. For instance:
281
+
282
+ ```bash
283
+ $ cd actionmailer
284
+ $ bundle exec ruby -w -Itest test/mail_layout_test.rb -n test_explicit_class_layout
285
+ ```
286
+
287
+ The `-n` option allows you to run a single method instead of the whole
288
+ file.
289
+
290
+ ##### Testing Active Record
291
+
292
+ This is how you run the Active Record test suite only for SQLite3:
293
+
294
+ ```bash
295
+ $ cd activerecord
296
+ $ bundle exec rake test:sqlite3
297
+ ```
298
+
299
+ You can now run the tests as you did for `sqlite3`. The tasks are respectively
300
+
301
+ ```bash
302
+ test:mysql
303
+ test:mysql2
304
+ test:postgresql
305
+ ```
306
+
307
+ Finally,
308
+
309
+ ```bash
310
+ $ bundle exec rake test
311
+ ```
312
+
313
+ will now run the four of them in turn.
314
+
315
+ You can also run any single test separately:
316
+
317
+ ```bash
318
+ $ ARCONN=sqlite3 ruby -Itest test/cases/associations/has_many_associations_test.rb
319
+ ```
320
+
321
+ To run a single test against all adapters, use:
322
+
323
+ ```bash
324
+ $ bundle exec rake TEST=test/cases/associations/has_many_associations_test.rb
325
+ ```
326
+
327
+ You can invoke `test_jdbcmysql`, `test_jdbcsqlite3` or `test_jdbcpostgresql` also. See the file `activerecord/RUNNING_UNIT_TESTS.rdoc` for information on running more targeted database tests, or the file `ci/travis.rb` for the test suite run by the continuous integration server.
328
+
329
+ ### Warnings
330
+
331
+ The test suite runs with warnings enabled. Ideally, Ruby on Rails should issue no warnings, but there may be a few, as well as some from third-party libraries. Please ignore (or fix!) them, if any, and submit patches that do not issue new warnings.
332
+
333
+ If you are sure about what you are doing and would like to have a more clear output, there's a way to override the flag:
334
+
335
+ ```bash
336
+ $ RUBYOPT=-W0 bundle exec rake test
337
+ ```
338
+
287
339
  ### Updating the CHANGELOG
288
340
 
289
341
  The CHANGELOG is an important part of every release. It keeps the list of changes for every Rails version.
290
342
 
291
343
  You should add an entry to the CHANGELOG of the framework that you modified if you're adding or removing a feature, committing a bug fix or adding deprecation notices. Refactorings and documentation changes generally should not go to the CHANGELOG.
292
344
 
293
- A CHANGELOG entry should summarize what was changed and should end with author's name and it should go on top of a CHANGELOG. You can use multiple lines if you need more space and you can attach code examples indented with 4 spaces. If a change is related to a specific issue, you should attach issue's number. Here is an example CHANGELOG entry:
345
+ A CHANGELOG entry should summarize what was changed and should end with author's name and it should go on top of a CHANGELOG. You can use multiple lines if you need more space and you can attach code examples indented with 4 spaces. If a change is related to a specific issue, you should attach the issue's number. Here is an example CHANGELOG entry:
294
346
 
295
347
  ```
296
348
  * Summary of a change that briefly describes what was changed. You can use multiple
@@ -309,14 +361,18 @@ A CHANGELOG entry should summarize what was changed and should end with author's
309
361
 
310
362
  Your name can be added directly after the last word if you don't provide any code examples or don't need multiple paragraphs. Otherwise, it's best to make as a new paragraph.
311
363
 
364
+ ### Updating the Gemfile.lock
365
+
366
+ Some changes requires the dependencies to be upgraded. In these cases make sure you run `bundle update` to get the right version of the dependency and commit the `Gemfile.lock` file within your changes.
367
+
312
368
  ### Sanity Check
313
369
 
314
370
  You should not be the only person who looks at the code before you submit it.
315
371
  If you know someone else who uses Rails, try asking them if they'll check out
316
372
  your work. If you don't know anyone else using Rails, try hopping into the IRC
317
- room or posting about your idea to the rails-core mailing list. Doing this in
318
- private before you push a patch out publicly is the smoke test for a patch:
319
- if you cant convince one other developer of the beauty of your code, you’re
373
+ room or posting about your idea to the rails-core mailing list. Doing this in
374
+ private before you push a patch out publicly is the "smoke test" for a patch:
375
+ if you can't convince one other developer of the beauty of your code, you’re
320
376
  unlikely to convince the core team either.
321
377
 
322
378
  ### Commit Your Changes
@@ -343,9 +399,9 @@ it should not be necessary to visit a webpage to check the history.
343
399
  Description can have multiple paragraphs and you can use code examples
344
400
  inside, just indent it with 4 spaces:
345
401
 
346
- class PostsController
402
+ class ArticlesController
347
403
  def index
348
- respond_with Post.limit(10)
404
+ render json: Article.limit(10)
349
405
  end
350
406
  end
351
407
 
@@ -467,11 +523,11 @@ the same way that you appreciate feedback on your patches.
467
523
 
468
524
  ### Iterate as Necessary
469
525
 
470
- It's entirely possible that the feedback you get will suggest changes. Don't get discouraged: the whole point of contributing to an active open source project is to tap into community knowledge. If people are encouraging you to tweak your code, then it's worth making the tweaks and resubmitting. If the feedback is that your code doesn't belong in the core, you might still think about releasing it as a gem.
526
+ It's entirely possible that the feedback you get will suggest changes. Don't get discouraged: the whole point of contributing to an active open source project is to tap into the knowledge of the community. If people are encouraging you to tweak your code, then it's worth making the tweaks and resubmitting. If the feedback is that your code doesn't belong in the core, you might still think about releasing it as a gem.
471
527
 
472
528
  #### Squashing commits
473
529
 
474
- One of the things that we may ask you to do is "squash your commits," which
530
+ One of the things that we may ask you to do is to "squash your commits", which
475
531
  will combine all of your commits into a single commit. We prefer pull requests
476
532
  that are a single commit. This makes it easier to backport changes to stable
477
533
  branches, squashing makes it easier to revert bad commits, and the git history
@@ -507,7 +563,35 @@ $ git push origin my_pull_request -f
507
563
  You should be able to refresh the pull request on GitHub and see that it has
508
564
  been updated.
509
565
 
510
- ### Backporting
566
+ #### Updating pull request
567
+
568
+ Sometimes you will be asked to make some changes to the code you have
569
+ already committed. This can include amending existing commits. In this
570
+ case Git will not allow you to push the changes as the pushed branch
571
+ and local branch do not match. Instead of opening a new pull request,
572
+ you can force push to your branch on GitHub as described earlier in
573
+ squashing commits section:
574
+
575
+ ```bash
576
+ $ git push origin my_pull_request -f
577
+ ```
578
+
579
+ This will update the branch and pull request on GitHub with your new code. Do
580
+ note that using force push may result in commits being lost on the remote branch; use it with care.
581
+
582
+
583
+ ### Older Versions of Ruby on Rails
584
+
585
+ If you want to add a fix to older versions of Ruby on Rails, you'll need to set up and switch to your own local tracking branch. Here is an example to switch to the 4-0-stable branch:
586
+
587
+ ```bash
588
+ $ git branch --track 4-0-stable origin/4-0-stable
589
+ $ git checkout 4-0-stable
590
+ ```
591
+
592
+ TIP: You may want to [put your Git branch name in your shell prompt](http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/) to make it easier to remember which version of the code you're working with.
593
+
594
+ #### Backporting
511
595
 
512
596
  Changes that are merged into master are intended for the next major release of Rails. Sometimes, it might be beneficial for your changes to propagate back to the maintenance releases for older stable branches. Generally, security fixes and bug fixes are good candidates for a backport, while new features and patches that introduce a change in behavior will not be accepted. When in doubt, it is best to consult a Rails team member before backporting your changes to avoid wasted effort.
513
597
 
@@ -40,7 +40,7 @@ Oscar Del Ben is a software engineer at <a href="http://www.wildfireapp.com/">Wi
40
40
  <% end %>
41
41
 
42
42
  <%= author('Tore Darell', 'toretore') do %>
43
- Tore Darell is an independent developer based in Menton, France who specialises in cruft-free web applications using Ruby, Rails and unobtrusive JavaScript. His home on the Internet is his blog <a href="http://tore.darell.no">Sneaky Abstractions</a>.
43
+ Tore Darell is an independent developer based in Menton, France who specialises in cruft-free web applications using Ruby, Rails and unobtrusive JavaScript. You can follow him on <a href="http://twitter.com/toretore">Twitter</a>.
44
44
  <% end %>
45
45
 
46
46
  <%= author('Jeff Dean', 'zilkey') do %>
@@ -64,7 +64,7 @@ Oscar Del Ben is a software engineer at <a href="http://www.wildfireapp.com/">Wi
64
64
  <% end %>
65
65
 
66
66
  <%= author('Pratik Naik', 'lifo') do %>
67
- Pratik Naik is a Ruby on Rails developer at <a href="http://www.37signals.com">37signals</a> and also a member of the <a href="http://rubyonrails.org/core">Rails core team</a>. He maintains a blog at <a href="http://m.onkey.org">has_many :bugs, :through =&gt; :rails</a> and has a semi-active <a href="http://twitter.com/lifo">twitter account</a>.
67
+ Pratik Naik is a Ruby on Rails developer at <a href="https://basecamp.com/">Basecamp</a> and also a member of the <a href="http://rubyonrails.org/core">Rails core team</a>. He maintains a blog at <a href="http://m.onkey.org">has_many :bugs, :through =&gt; :rails</a> and has a semi-active <a href="http://twitter.com/lifo">twitter account</a>.
68
68
  <% end %>
69
69
 
70
70
  <%= author('Emilio Tagua', 'miloops') do %>