rails 4.2.0.beta3 → 4.2.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -7
  3. data/guides/output/2_2_release_notes.html +724 -0
  4. data/guides/output/2_3_release_notes.html +870 -0
  5. data/guides/output/3_0_release_notes.html +773 -0
  6. data/guides/output/3_1_release_notes.html +740 -0
  7. data/guides/output/3_2_release_notes.html +797 -0
  8. data/guides/output/4_0_release_notes.html +523 -0
  9. data/guides/output/4_1_release_notes.html +806 -0
  10. data/guides/output/4_2_release_notes.html +728 -0
  11. data/guides/output/Gemfile +6 -0
  12. data/guides/output/_license.html +226 -0
  13. data/guides/output/_welcome.html +233 -0
  14. data/guides/output/action_controller_overview.html +1335 -0
  15. data/guides/output/action_mailer_basics.html +928 -0
  16. data/guides/output/action_view_overview.html +1509 -0
  17. data/guides/output/active_job_basics.html +546 -0
  18. data/guides/output/active_model_basics.html +438 -0
  19. data/guides/output/active_record_basics.html +594 -0
  20. data/guides/output/active_record_callbacks.html +592 -0
  21. data/guides/output/active_record_migrations.html +1123 -0
  22. data/guides/output/active_record_postgresql.html +675 -0
  23. data/guides/output/active_record_querying.html +1796 -0
  24. data/guides/output/active_record_validations.html +1301 -0
  25. data/guides/output/active_support_core_extensions.html +3450 -0
  26. data/guides/output/active_support_instrumentation.html +1121 -0
  27. data/guides/output/api_documentation_guidelines.html +498 -0
  28. data/guides/output/asset_pipeline.html +1167 -0
  29. data/guides/output/association_basics.html +2086 -0
  30. data/guides/output/caching_with_rails.html +553 -0
  31. data/guides/output/command_line.html +791 -0
  32. data/guides/output/configuring.html +1055 -0
  33. data/guides/output/contributing_to_ruby_on_rails.html +657 -0
  34. data/guides/output/credits.html +284 -0
  35. data/guides/output/debugging_rails_applications.html +1014 -0
  36. data/guides/output/development_dependencies_install.html +478 -0
  37. data/guides/output/engines.html +1438 -0
  38. data/guides/output/form_helpers.html +1074 -0
  39. data/guides/output/generators.html +838 -0
  40. data/guides/output/getting_started.html +2092 -0
  41. data/guides/output/i18n.html +1198 -0
  42. data/guides/output/images/akshaysurve.jpg +0 -0
  43. data/guides/output/images/belongs_to.png +0 -0
  44. data/guides/output/images/book_icon.gif +0 -0
  45. data/guides/output/images/bullet.gif +0 -0
  46. data/guides/output/images/chapters_icon.gif +0 -0
  47. data/guides/output/images/check_bullet.gif +0 -0
  48. data/guides/output/images/credits_pic_blank.gif +0 -0
  49. data/guides/output/images/csrf.png +0 -0
  50. data/guides/output/images/edge_badge.png +0 -0
  51. data/guides/output/images/favicon.ico +0 -0
  52. data/guides/output/images/feature_tile.gif +0 -0
  53. data/guides/output/images/footer_tile.gif +0 -0
  54. data/guides/output/images/fxn.png +0 -0
  55. data/guides/output/images/getting_started/article_with_comments.png +0 -0
  56. data/guides/output/images/getting_started/challenge.png +0 -0
  57. data/guides/output/images/getting_started/confirm_dialog.png +0 -0
  58. data/guides/output/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
  59. data/guides/output/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
  60. data/guides/output/images/getting_started/form_with_errors.png +0 -0
  61. data/guides/output/images/getting_started/index_action_with_edit_link.png +0 -0
  62. data/guides/output/images/getting_started/new_article.png +0 -0
  63. data/guides/output/images/getting_started/new_post.png +0 -0
  64. data/guides/output/images/getting_started/post_with_comments.png +0 -0
  65. data/guides/output/images/getting_started/rails_welcome.png +0 -0
  66. data/guides/output/images/getting_started/routing_error_no_controller.png +0 -0
  67. data/guides/output/images/getting_started/routing_error_no_route_matches.png +0 -0
  68. data/guides/output/images/getting_started/show_action_for_articles.png +0 -0
  69. data/guides/output/images/getting_started/show_action_for_posts.png +0 -0
  70. data/guides/output/images/getting_started/template_is_missing_articles_new.png +0 -0
  71. data/guides/output/images/getting_started/template_is_missing_posts_new.png +0 -0
  72. data/guides/output/images/getting_started/undefined_method_post_path.png +0 -0
  73. data/guides/output/images/getting_started/unknown_action_create_for_articles.png +0 -0
  74. data/guides/output/images/getting_started/unknown_action_create_for_posts.png +0 -0
  75. data/guides/output/images/getting_started/unknown_action_new_for_articles.png +0 -0
  76. data/guides/output/images/getting_started/unknown_action_new_for_posts.png +0 -0
  77. data/guides/output/images/grey_bullet.gif +0 -0
  78. data/guides/output/images/habtm.png +0 -0
  79. data/guides/output/images/has_many.png +0 -0
  80. data/guides/output/images/has_many_through.png +0 -0
  81. data/guides/output/images/has_one.png +0 -0
  82. data/guides/output/images/has_one_through.png +0 -0
  83. data/guides/output/images/header_backdrop.png +0 -0
  84. data/guides/output/images/header_tile.gif +0 -0
  85. data/guides/output/images/i18n/demo_html_safe.png +0 -0
  86. data/guides/output/images/i18n/demo_localized_pirate.png +0 -0
  87. data/guides/output/images/i18n/demo_translated_en.png +0 -0
  88. data/guides/output/images/i18n/demo_translated_pirate.png +0 -0
  89. data/guides/output/images/i18n/demo_translation_missing.png +0 -0
  90. data/guides/output/images/i18n/demo_untranslated.png +0 -0
  91. data/guides/output/images/icons/README +5 -0
  92. data/guides/output/images/icons/callouts/1.png +0 -0
  93. data/guides/output/images/icons/callouts/10.png +0 -0
  94. data/guides/output/images/icons/callouts/11.png +0 -0
  95. data/guides/output/images/icons/callouts/12.png +0 -0
  96. data/guides/output/images/icons/callouts/13.png +0 -0
  97. data/guides/output/images/icons/callouts/14.png +0 -0
  98. data/guides/output/images/icons/callouts/15.png +0 -0
  99. data/guides/output/images/icons/callouts/2.png +0 -0
  100. data/guides/output/images/icons/callouts/3.png +0 -0
  101. data/guides/output/images/icons/callouts/4.png +0 -0
  102. data/guides/output/images/icons/callouts/5.png +0 -0
  103. data/guides/output/images/icons/callouts/6.png +0 -0
  104. data/guides/output/images/icons/callouts/7.png +0 -0
  105. data/guides/output/images/icons/callouts/8.png +0 -0
  106. data/guides/output/images/icons/callouts/9.png +0 -0
  107. data/guides/output/images/icons/caution.png +0 -0
  108. data/guides/output/images/icons/example.png +0 -0
  109. data/guides/output/images/icons/home.png +0 -0
  110. data/guides/output/images/icons/important.png +0 -0
  111. data/guides/output/images/icons/next.png +0 -0
  112. data/guides/output/images/icons/note.png +0 -0
  113. data/guides/output/images/icons/prev.png +0 -0
  114. data/guides/output/images/icons/tip.png +0 -0
  115. data/guides/output/images/icons/up.png +0 -0
  116. data/guides/output/images/icons/warning.png +0 -0
  117. data/guides/output/images/nav_arrow.gif +0 -0
  118. data/guides/output/images/oscardelben.jpg +0 -0
  119. data/guides/output/images/polymorphic.png +0 -0
  120. data/guides/output/images/radar.png +0 -0
  121. data/guides/output/images/rails4_features.png +0 -0
  122. data/guides/output/images/rails_guides_kindle_cover.jpg +0 -0
  123. data/guides/output/images/rails_guides_logo.gif +0 -0
  124. data/guides/output/images/rails_logo_remix.gif +0 -0
  125. data/guides/output/images/session_fixation.png +0 -0
  126. data/guides/output/images/tab_grey.gif +0 -0
  127. data/guides/output/images/tab_info.gif +0 -0
  128. data/guides/output/images/tab_note.gif +0 -0
  129. data/guides/output/images/tab_red.gif +0 -0
  130. data/guides/output/images/tab_yellow.gif +0 -0
  131. data/guides/output/images/tab_yellow.png +0 -0
  132. data/guides/output/images/vijaydev.jpg +0 -0
  133. data/guides/output/index.html +354 -0
  134. data/guides/output/initialization.html +876 -0
  135. data/guides/output/javascripts/guides.js +59 -0
  136. data/guides/output/javascripts/jquery.min.js +4 -0
  137. data/guides/output/javascripts/responsive-tables.js +43 -0
  138. data/guides/output/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
  139. data/guides/output/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
  140. data/guides/output/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
  141. data/guides/output/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
  142. data/guides/output/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
  143. data/guides/output/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
  144. data/guides/output/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
  145. data/guides/output/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
  146. data/guides/output/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
  147. data/guides/output/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
  148. data/guides/output/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
  149. data/guides/output/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
  150. data/guides/output/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
  151. data/guides/output/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
  152. data/guides/output/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
  153. data/guides/output/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
  154. data/guides/output/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
  155. data/guides/output/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
  156. data/guides/output/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
  157. data/guides/output/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
  158. data/guides/output/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
  159. data/guides/output/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
  160. data/guides/output/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
  161. data/guides/output/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
  162. data/guides/output/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
  163. data/guides/output/javascripts/syntaxhighlighter/shCore.js +17 -0
  164. data/guides/output/layout.html +448 -0
  165. data/guides/output/layouts_and_rendering.html +1541 -0
  166. data/guides/output/maintenance_policy.html +257 -0
  167. data/guides/output/migrations.html +1360 -0
  168. data/guides/output/nested_model_forms.html +412 -0
  169. data/guides/output/plugins.html +644 -0
  170. data/guides/output/rails_application_templates.html +450 -0
  171. data/guides/output/rails_on_rack.html +547 -0
  172. data/guides/output/routing.html +1631 -0
  173. data/guides/output/ruby_on_rails_guides_guidelines.html +329 -0
  174. data/guides/output/security.html +935 -0
  175. data/guides/output/stylesheets/fixes.css +16 -0
  176. data/guides/output/stylesheets/kindle.css +11 -0
  177. data/guides/output/stylesheets/main.css +713 -0
  178. data/guides/output/stylesheets/print.css +52 -0
  179. data/guides/output/stylesheets/reset.css +43 -0
  180. data/guides/output/stylesheets/responsive-tables.css +50 -0
  181. data/guides/output/stylesheets/style.css +13 -0
  182. data/guides/output/stylesheets/syntaxhighlighter/shCore.css +226 -0
  183. data/guides/output/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
  184. data/guides/output/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
  185. data/guides/output/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
  186. data/guides/output/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
  187. data/guides/output/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
  188. data/guides/output/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
  189. data/guides/output/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
  190. data/guides/output/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
  191. data/guides/output/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
  192. data/guides/output/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
  193. data/guides/output/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
  194. data/guides/output/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
  195. data/guides/output/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
  196. data/guides/output/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
  197. data/guides/output/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
  198. data/guides/output/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
  199. data/guides/output/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
  200. data/guides/output/testing.html +1350 -0
  201. data/guides/output/upgrading_ruby_on_rails.html +1135 -0
  202. data/guides/output/working_with_javascript_in_rails.html +587 -0
  203. data/guides/source/4_0_release_notes.md +2 -2
  204. data/guides/source/4_2_release_notes.md +9 -2
  205. data/guides/source/action_controller_overview.md +3 -1
  206. data/guides/source/action_mailer_basics.md +1 -2
  207. data/guides/source/active_job_basics.md +25 -2
  208. data/guides/source/active_model_basics.md +350 -19
  209. data/guides/source/active_record_basics.md +2 -2
  210. data/guides/source/active_record_migrations.md +1 -1
  211. data/guides/source/active_record_validations.md +12 -4
  212. data/guides/source/active_support_core_extensions.md +7 -9
  213. data/guides/source/active_support_instrumentation.md +2 -0
  214. data/guides/source/association_basics.md +7 -7
  215. data/guides/source/configuring.md +24 -0
  216. data/guides/source/contributing_to_ruby_on_rails.md +1 -1
  217. data/guides/source/credits.html.erb +1 -1
  218. data/guides/source/documents.yaml +5 -0
  219. data/guides/source/engines.md +2 -2
  220. data/guides/source/form_helpers.md +6 -0
  221. data/guides/source/i18n.md +6 -9
  222. data/guides/source/layouts_and_rendering.md +1 -1
  223. data/guides/source/plugins.md +2 -2
  224. data/guides/source/rails_on_rack.md +4 -0
  225. data/guides/source/testing.md +1 -0
  226. data/guides/source/upgrading_ruby_on_rails.md +5 -5
  227. metadata +227 -27
@@ -0,0 +1,657 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
7
+
8
+ <title>Contributing to Ruby on Rails — Ruby on Rails Guides</title>
9
+ <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
10
+ <link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
11
+
12
+ <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" />
13
+ <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeRailsGuides.css" />
14
+
15
+ <link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" />
16
+
17
+ <link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
18
+ </head>
19
+ <body class="guide">
20
+ <div id="topNav">
21
+ <div class="wrapper">
22
+ <strong class="more-info-label">More at <a href="http://rubyonrails.org/">rubyonrails.org:</a> </strong>
23
+ <span class="red-button more-info-button">
24
+ More Ruby on Rails
25
+ </span>
26
+ <ul class="more-info-links s-hidden">
27
+ <li class="more-info"><a href="http://rubyonrails.org/">Overview</a></li>
28
+ <li class="more-info"><a href="http://rubyonrails.org/download">Download</a></li>
29
+ <li class="more-info"><a href="http://rubyonrails.org/deploy">Deploy</a></li>
30
+ <li class="more-info"><a href="https://github.com/rails/rails">Code</a></li>
31
+ <li class="more-info"><a href="http://rubyonrails.org/screencasts">Screencasts</a></li>
32
+ <li class="more-info"><a href="http://rubyonrails.org/documentation">Documentation</a></li>
33
+ <li class="more-info"><a href="http://rubyonrails.org/community">Community</a></li>
34
+ <li class="more-info"><a href="http://weblog.rubyonrails.org/">Blog</a></li>
35
+ </ul>
36
+ </div>
37
+ </div>
38
+ <div id="header">
39
+ <div class="wrapper clearfix">
40
+ <h1><a href="index.html" title="Return to home page">Guides.rubyonrails.org</a></h1>
41
+ <ul class="nav">
42
+ <li><a class="nav-item" href="index.html">Home</a></li>
43
+ <li class="guides-index guides-index-large">
44
+ <a href="index.html" id="guidesMenu" class="guides-index-item nav-item">Guides Index</a>
45
+ <div id="guides" class="clearfix" style="display: none;">
46
+ <hr />
47
+ <dl class="L">
48
+ <dt>Start Here</dt>
49
+ <dd><a href="getting_started.html">Getting Started with Rails</a></dd>
50
+ <dt>Models</dt>
51
+ <dd><a href="active_record_basics.html">Active Record Basics</a></dd>
52
+ <dd><a href="active_record_migrations.html">Active Record Migrations</a></dd>
53
+ <dd><a href="active_record_validations.html">Active Record Validations</a></dd>
54
+ <dd><a href="active_record_callbacks.html">Active Record Callbacks</a></dd>
55
+ <dd><a href="association_basics.html">Active Record Associations</a></dd>
56
+ <dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
57
+ <dt>Views</dt>
58
+ <dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
59
+ <dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
60
+ <dt>Controllers</dt>
61
+ <dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
62
+ <dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
63
+ </dl>
64
+ <dl class="R">
65
+ <dt>Digging Deeper</dt>
66
+ <dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
67
+ <dd><a href="i18n.html">Rails Internationalization API</a></dd>
68
+ <dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
69
+ <dd><a href="active_job_basics.html">Active Job Basics</a></dd>
70
+ <dd><a href="security.html">Securing Rails Applications</a></dd>
71
+ <dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
72
+ <dd><a href="configuring.html">Configuring Rails Applications</a></dd>
73
+ <dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd>
74
+ <dd><a href="asset_pipeline.html">Asset Pipeline</a></dd>
75
+ <dd><a href="working_with_javascript_in_rails.html">Working with JavaScript in Rails</a></dd>
76
+ <dt>Extending Rails</dt>
77
+ <dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
78
+ <dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd>
79
+ <dt>Contributing to Ruby on Rails</dt>
80
+ <dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
81
+ <dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
82
+ <dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd>
83
+ <dt>Maintenance Policy</dt>
84
+ <dd><a href="maintenance_policy.html">Maintenance Policy</a></dd>
85
+ <dt>Release Notes</dt>
86
+ <dd><a href="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</a></dd>
87
+ <dd><a href="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</a></dd>
88
+ <dd><a href="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</a></dd>
89
+ <dd><a href="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</a></dd>
90
+ <dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</a></dd>
91
+ <dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd>
92
+ <dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd>
93
+ <dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd>
94
+ </dl>
95
+ </div>
96
+ </li>
97
+ <li><a class="nav-item" href="contributing_to_ruby_on_rails.html">Contribute</a></li>
98
+ <li><a class="nav-item" href="credits.html">Credits</a></li>
99
+ <li class="guides-index guides-index-small">
100
+ <select class="guides-index-item nav-item">
101
+ <option value="index.html">Guides Index</option>
102
+ <optgroup label="Start Here">
103
+ <option value="getting_started.html">Getting Started with Rails</option>
104
+ </optgroup>
105
+ <optgroup label="Models">
106
+ <option value="active_record_basics.html">Active Record Basics</option>
107
+ <option value="active_record_migrations.html">Active Record Migrations</option>
108
+ <option value="active_record_validations.html">Active Record Validations</option>
109
+ <option value="active_record_callbacks.html">Active Record Callbacks</option>
110
+ <option value="association_basics.html">Active Record Associations</option>
111
+ <option value="active_record_querying.html">Active Record Query Interface</option>
112
+ </optgroup>
113
+ <optgroup label="Views">
114
+ <option value="layouts_and_rendering.html">Layouts and Rendering in Rails</option>
115
+ <option value="form_helpers.html">Action View Form Helpers</option>
116
+ </optgroup>
117
+ <optgroup label="Controllers">
118
+ <option value="action_controller_overview.html">Action Controller Overview</option>
119
+ <option value="routing.html">Rails Routing from the Outside In</option>
120
+ </optgroup>
121
+ <optgroup label="Digging Deeper">
122
+ <option value="active_support_core_extensions.html">Active Support Core Extensions</option>
123
+ <option value="i18n.html">Rails Internationalization API</option>
124
+ <option value="action_mailer_basics.html">Action Mailer Basics</option>
125
+ <option value="active_job_basics.html">Active Job Basics</option>
126
+ <option value="security.html">Securing Rails Applications</option>
127
+ <option value="debugging_rails_applications.html">Debugging Rails Applications</option>
128
+ <option value="configuring.html">Configuring Rails Applications</option>
129
+ <option value="command_line.html">Rails Command Line Tools and Rake Tasks</option>
130
+ <option value="asset_pipeline.html">Asset Pipeline</option>
131
+ <option value="working_with_javascript_in_rails.html">Working with JavaScript in Rails</option>
132
+ </optgroup>
133
+ <optgroup label="Extending Rails">
134
+ <option value="rails_on_rack.html">Rails on Rack</option>
135
+ <option value="generators.html">Creating and Customizing Rails Generators</option>
136
+ </optgroup>
137
+ <optgroup label="Contributing to Ruby on Rails">
138
+ <option value="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</option>
139
+ <option value="api_documentation_guidelines.html">API Documentation Guidelines</option>
140
+ <option value="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</option>
141
+ </optgroup>
142
+ <optgroup label="Maintenance Policy">
143
+ <option value="maintenance_policy.html">Maintenance Policy</option>
144
+ </optgroup>
145
+ <optgroup label="Release Notes">
146
+ <option value="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</option>
147
+ <option value="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</option>
148
+ <option value="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</option>
149
+ <option value="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</option>
150
+ <option value="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</option>
151
+ <option value="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</option>
152
+ <option value="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</option>
153
+ <option value="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</option>
154
+ </optgroup>
155
+ </select>
156
+ </li>
157
+ </ul>
158
+ </div>
159
+ </div>
160
+ <hr class="hide" />
161
+
162
+ <div id="feature">
163
+ <div class="wrapper">
164
+ <h2>Contributing to Ruby on Rails</h2><p>This guide covers ways in which <em>you</em> can become a part of the ongoing development of Ruby on Rails.</p><p>After reading this guide, you will know:</p>
165
+ <ul>
166
+ <li>How to use GitHub to report issues.</li>
167
+ <li>How to clone master and run the test suite.</li>
168
+ <li>How to help resolve existing issues.</li>
169
+ <li>How to contribute to the Ruby on Rails documentation.</li>
170
+ <li>How to contribute to the Ruby on Rails code.</li>
171
+ </ul>
172
+ <p>Ruby on Rails is not &quot;someone else&#39;s framework.&quot; Over the years, hundreds of people have contributed to Ruby on Rails ranging from a single character to massive architectural changes or significant documentation - all with the goal of making Ruby on Rails better for everyone. Even if you don&#39;t feel up to writing code or documentation yet, there are a variety of other ways that you can contribute, from reporting issues to testing patches.</p>
173
+
174
+ <div id="subCol">
175
+ <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
176
+ <ol class="chapters">
177
+ <li>
178
+ <a href="#reporting-an-issue">Reporting an Issue</a>
179
+
180
+ <ul>
181
+ <li><a href="#creating-a-bug-report">Creating a Bug Report</a></li>
182
+ <li><a href="#create-a-self-contained-gist-for-active-record-and-action-controller-issues">Create a Self-Contained gist for Active Record and Action Controller Issues</a></li>
183
+ <li><a href="#special-treatment-for-security-issues">Special Treatment for Security Issues</a></li>
184
+ <li><a href="#what-about-feature-requests-questionmark">What about Feature Requests?</a></li>
185
+ </ul>
186
+ </li>
187
+ <li>
188
+ <a href="#helping-to-resolve-existing-issues">Helping to Resolve Existing Issues</a>
189
+
190
+ <ul>
191
+ <li><a href="#verifying-bug-reports">Verifying Bug Reports</a></li>
192
+ <li><a href="#testing-patches">Testing Patches</a></li>
193
+ </ul>
194
+ </li>
195
+ <li><a href="#contributing-to-the-rails-documentation">Contributing to the Rails Documentation</a></li>
196
+ <li>
197
+ <a href="#contributing-to-the-rails-code">Contributing to the Rails Code</a>
198
+
199
+ <ul>
200
+ <li><a href="#setting-up-a-development-environment">Setting Up a Development Environment</a></li>
201
+ <li><a href="#clone-the-rails-repository">Clone the Rails Repository</a></li>
202
+ <li><a href="#running-an-application-against-your-local-branch">Running an Application Against Your Local Branch</a></li>
203
+ <li><a href="#write-your-code">Write Your Code</a></li>
204
+ <li><a href="#benchmark-your-code">Benchmark Your Code</a></li>
205
+ <li><a href="#running-tests">Running Tests</a></li>
206
+ <li><a href="#warnings">Warnings</a></li>
207
+ <li><a href="#updating-the-changelog">Updating the CHANGELOG</a></li>
208
+ <li><a href="#sanity-check">Sanity Check</a></li>
209
+ <li><a href="#commit-your-changes">Commit Your Changes</a></li>
210
+ <li><a href="#update-your-branch">Update Your Branch</a></li>
211
+ <li><a href="#fork">Fork</a></li>
212
+ <li><a href="#issue-a-pull-request">Issue a Pull Request</a></li>
213
+ <li><a href="#get-some-feedback">Get some Feedback</a></li>
214
+ <li><a href="#iterate-as-necessary">Iterate as Necessary</a></li>
215
+ <li><a href="#older-versions-of-ruby-on-rails">Older Versions of Ruby on Rails</a></li>
216
+ </ul>
217
+ </li>
218
+ <li><a href="#rails-contributors">Rails Contributors</a></li>
219
+ </ol>
220
+
221
+ </div>
222
+
223
+ </div>
224
+ </div>
225
+
226
+ <div id="container">
227
+ <div class="wrapper">
228
+ <div id="mainCol">
229
+ <h3 id="reporting-an-issue">1 Reporting an Issue</h3><p>Ruby on Rails uses <a href="https://github.com/rails/rails/issues">GitHub Issue Tracking</a> to track issues (primarily bugs and contributions of new code). If you've found a bug in Ruby on Rails, this is the place to start. You'll need to create a (free) GitHub account in order to submit an issue, to comment on them or to create pull requests.</p><div class="note"><p>Bugs in the most recent released version of Ruby on Rails are likely to get the most attention. Also, the Rails core team is always interested in feedback from those who can take the time to test <em>edge Rails</em> (the code for the version of Rails that is currently under development). Later in this guide you'll find out how to get edge Rails for testing.</p></div><h4 id="creating-a-bug-report">1.1 Creating a Bug Report</h4><p>If you've found a problem in Ruby on Rails which is not a security risk, do a search in GitHub under <a href="https://github.com/rails/rails/issues">Issues</a> in case it has already been reported. If you do not find any issue addressing it you may proceed to <a href="https://github.com/rails/rails/issues/new">open a new one</a>. (See the next section for reporting security issues.)</p><p>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.</p><p>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.</p><h4 id="create-a-self-contained-gist-for-active-record-and-action-controller-issues">1.2 Create a Self-Contained gist for Active Record and Action Controller Issues</h4><p>If you are filing a bug report, please use
230
+ <a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb">Active Record template for gems</a> or
231
+ <a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/action_controller_gem.rb">Action Controller template for gems</a>
232
+ if the bug is found in a published gem, and
233
+ <a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_master.rb">Active Record template for master</a> or
234
+ <a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/action_controller_master.rb">Action Controller template for master</a>
235
+ if the bug happens in the master branch.</p><h4 id="special-treatment-for-security-issues">1.3 Special Treatment for Security Issues</h4><div class="warning"><p>Please do not report security vulnerabilities with public GitHub issue reports. The <a href="http://rubyonrails.org/security">Rails security policy page</a> details the procedure to follow for security issues.</p></div><h4 id="what-about-feature-requests-questionmark">1.4 What about Feature Requests?</h4><p>Please don't put "feature request" items into GitHub Issues. If there's a new
236
+ feature that you want to see added to Ruby on Rails, you'll need to write the
237
+ code yourself - or convince someone else to partner with you to write the code.
238
+ Later in this guide you'll find detailed instructions for proposing a patch to
239
+ Ruby on Rails. If you enter a wish list item in GitHub Issues with no code, you
240
+ can expect it to be marked "invalid" as soon as it's reviewed.</p><p>Sometimes, the line between 'bug' and 'feature' is a hard one to draw.
241
+ Generally, a feature is anything that adds new behavior, while a bug is
242
+ anything that fixes already existing behavior that is misbehaving. Sometimes,
243
+ the core team will have to make a judgement call. That said, the distinction
244
+ generally just affects which release your patch will get in to; we love feature
245
+ submissions! They just won't get backported to maintenance branches.</p><p>If you'd like feedback on an idea for a feature before doing the work for make
246
+ a patch, please send an email to the <a href="https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core">rails-core mailing
247
+ list</a>. You
248
+ might get no response, which means that everyone is indifferent. You might find
249
+ someone who's also interested in building that feature. You might get a "This
250
+ won't be accepted." But it's the proper place to discuss new ideas. GitHub
251
+ Issues are not a particularly good venue for the sometimes long and involved
252
+ discussions new features require.</p><h3 id="helping-to-resolve-existing-issues">2 Helping to Resolve Existing Issues</h3><p>As a next step beyond reporting issues, you can help the core team resolve existing issues. If you check the <a href="https://github.com/rails/rails/issues">Everyone's Issues</a> list in GitHub Issues, you'll find lots of issues already requiring attention. What can you do for these? Quite a bit, actually:</p><h4 id="verifying-bug-reports">2.1 Verifying Bug Reports</h4><p>For starters, it helps just to verify bug reports. Can you reproduce the reported issue on your own computer? If so, you can add a comment to the issue saying that you're seeing the same thing.</p><p>If something is very vague, can you help squash it down into something specific? Maybe you can provide additional information to help reproduce a bug, or help by eliminating needless steps that aren't required to demonstrate the problem.</p><p>If you find a bug report without a test, it's very useful to contribute a failing test. This is also a great way to get started exploring the source code: looking at the existing test files will teach you how to write more tests. New tests are best contributed in the form of a patch, as explained later on in the "Contributing to the Rails Code" section.</p><p>Anything you can do to make bug reports more succinct or easier to reproduce is a help to folks trying to write code to fix those bugs - whether you end up writing the code yourself or not.</p><h4 id="testing-patches">2.2 Testing Patches</h4><p>You can also help out by examining pull requests that have been submitted to Ruby on Rails via GitHub. To apply someone's changes you need first to create a dedicated branch:</p><div class="code_container">
253
+ <pre class="brush: plain; gutter: false; toolbar: false">
254
+ $ git checkout -b testing_branch
255
+
256
+ </pre>
257
+ </div>
258
+ <p>Then you can use their remote branch to update your codebase. For example, let's say the GitHub user JohnSmith has forked and pushed to a topic branch "orange" located at <a href="https://github.com/JohnSmith/rails">https://github.com/JohnSmith/rails</a>.</p><div class="code_container">
259
+ <pre class="brush: plain; gutter: false; toolbar: false">
260
+ $ git remote add JohnSmith git://github.com/JohnSmith/rails.git
261
+ $ git pull JohnSmith orange
262
+
263
+ </pre>
264
+ </div>
265
+ <p>After applying their branch, test it out! Here are some things to think about:</p>
266
+ <ul>
267
+ <li>Does the change actually work?</li>
268
+ <li>Are you happy with the tests? Can you follow what they're testing? Are there any tests missing?</li>
269
+ <li>Does it have the proper documentation coverage? Should documentation elsewhere be updated?</li>
270
+ <li>Do you like the implementation? Can you think of a nicer or faster way to implement a part of their change?</li>
271
+ </ul>
272
+ <p>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:</p>
273
+ <blockquote>
274
+ <p>I like the way you've restructured that code in generate_finder_sql - much nicer. The tests look good too.</p>
275
+ </blockquote>
276
+ <p>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.</p><h3 id="contributing-to-the-rails-documentation">3 Contributing to the Rails Documentation</h3><p>Ruby on Rails has two main sets of documentation: the guides, which help you
277
+ learn about Ruby on Rails, and the API, which serves as a reference.</p><p>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 <a href="https://wiki.github.com/rails/docrails/translating-rails-guides">Translating Rails Guides</a>.</p><p>You can either open a pull request to <a href="http://github.com/rails/rails">Rails</a> or
278
+ ask the <a href="http://rubyonrails.org/core">Rails core team</a> for commit access on
279
+ <a href="http://github.com/rails/docrails">docrails</a> if you contribute regularly.
280
+ Please do not open pull requests in docrails, if you'd like to get feedback on your
281
+ change, ask for it in <a href="http://github.com/rails/rails">Rails</a> instead.</p><p>Docrails is merged with master regularly, so you are effectively editing the Ruby on Rails documentation.</p><p>If you are unsure of the documentation changes, you can create an issue in the <a href="https://github.com/rails/rails/issues">Rails</a> issues tracker on GitHub.</p><p>When working with documentation, please take into account the <a href="api_documentation_guidelines.html">API Documentation Guidelines</a> and the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>.</p><div class="note"><p>As explained earlier, ordinary code patches should have proper documentation coverage. Docrails is only used for isolated documentation improvements.</p></div><div class="note"><p>To help our CI servers you should add [ci skip] to your documentation commit message to skip build on that commit. Please remember to use it for commits containing only documentation changes.</p></div><div class="warning"><p>Docrails has a very strict policy: no code can be touched whatsoever, no matter how trivial or small the change. Only RDoc and guides can be edited via docrails. Also, CHANGELOGs should never be edited in docrails.</p></div><h3 id="contributing-to-the-rails-code">4 Contributing to the Rails Code</h3><h4 id="setting-up-a-development-environment">4.1 Setting Up a Development Environment</h4><p>To move on from submitting bugs to helping resolve existing issues or contributing your own code to Ruby on Rails, you <em>must</em> 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.</p><h5 id="the-easy-way">4.1.1 The Easy Way</h5><p>The easiest and recommended way to get a development environment ready to hack is to use the <a href="https://github.com/rails/rails-dev-box">Rails development box</a>.</p><h5 id="the-hard-way">4.1.2 The Hard Way</h5><p>In case you can't use the Rails development box, see <a href="development_dependencies_install.html">this other guide</a>.</p><h4 id="clone-the-rails-repository">4.2 Clone the Rails Repository</h4><p>To be able to contribute code, you need to clone the Rails repository:</p><div class="code_container">
282
+ <pre class="brush: plain; gutter: false; toolbar: false">
283
+ $ git clone git://github.com/rails/rails.git
284
+
285
+ </pre>
286
+ </div>
287
+ <p>and create a dedicated branch:</p><div class="code_container">
288
+ <pre class="brush: plain; gutter: false; toolbar: false">
289
+ $ cd rails
290
+ $ git checkout -b my_new_branch
291
+
292
+ </pre>
293
+ </div>
294
+ <p>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.</p><h4 id="running-an-application-against-your-local-branch">4.3 Running an Application Against Your Local Branch</h4><p>In case you need a dummy Rails app to test changes, the <code>--dev</code> flag of <code>rails new</code> generates an application that uses your local branch:</p><div class="code_container">
295
+ <pre class="brush: plain; gutter: false; toolbar: false">
296
+ $ cd rails
297
+ $ bundle exec rails new ~/my-test-app --dev
298
+
299
+ </pre>
300
+ </div>
301
+ <p>The application generated in <code>~/my-test-app</code> runs against your local branch
302
+ and in particular sees any modifications upon server reboot.</p><h4 id="write-your-code">4.4 Write Your Code</h4><p>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 <code>git branch -a</code>). But if you're planning to submit your change back for inclusion in Rails, keep a few things in mind:</p>
303
+ <ul>
304
+ <li>Get the code right.</li>
305
+ <li>Use Rails idioms and helpers.</li>
306
+ <li>Include tests that fail without your code, and pass with it.</li>
307
+ <li>Update the (surrounding) documentation, examples elsewhere, and the guides: whatever is affected by your contribution.</li>
308
+ </ul>
309
+ <div class="info"><p>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.</p></div><h5 id="follow-the-coding-conventions">4.4.1 Follow the Coding Conventions</h5><p>Rails follows a simple set of coding style conventions:</p>
310
+ <ul>
311
+ <li>Two spaces, no tabs (for indentation).</li>
312
+ <li>No trailing whitespace. Blank lines should not have any spaces.</li>
313
+ <li>Indent after private/protected.</li>
314
+ <li>Use Ruby &gt;= 1.9 syntax for hashes. Prefer <code>{ a: :b }</code> over <code>{ :a =&gt; :b }</code>.</li>
315
+ <li>Prefer <code>&amp;&amp;</code>/<code>||</code> over <code>and</code>/<code>or</code>.</li>
316
+ <li>Prefer class &lt;&lt; self over self.method for class methods.</li>
317
+ <li>Use <code>MyClass.my_method(my_arg)</code> not <code>my_method( my_arg )</code> or <code>my_method my_arg</code>.</li>
318
+ <li>Use <code>a = b</code> and not <code>a=b</code>.</li>
319
+ <li>Use assert_not methods instead of refute.</li>
320
+ <li>Prefer <code>method { do_stuff }</code> instead of <code>method{do_stuff}</code> for single-line blocks.</li>
321
+ <li>Follow the conventions in the source you see used already.</li>
322
+ </ul>
323
+ <p>The above are guidelines - please use your best judgment in using them.</p><h4 id="benchmark-your-code">4.5 Benchmark Your Code</h4><p>If your change has an impact on the performance of Rails, please use the
324
+ <a href="https://github.com/evanphx/benchmark-ips">benchmark-ips</a> gem to provide
325
+ benchmark results for comparison.</p><p>Here's an example of using benchmark-ips:</p><div class="code_container">
326
+ <pre class="brush: ruby; gutter: false; toolbar: false">
327
+ require 'benchmark/ips'
328
+
329
+ Benchmark.ips do |x|
330
+ x.report('addition') { 1 + 2 }
331
+ x.report('addition with send') { 1.send(:+, 2) }
332
+ end
333
+
334
+ </pre>
335
+ </div>
336
+ <p>This will generate a report with the following information:</p><div class="code_container">
337
+ <pre class="brush: plain; gutter: false; toolbar: false">
338
+ Calculating -------------------------------------
339
+ addition 69114 i/100ms
340
+ addition with send 64062 i/100ms
341
+ -------------------------------------------------
342
+ addition 5307644.4 (±3.5%) i/s - 26539776 in 5.007219s
343
+ addition with send 3702897.9 (±3.5%) i/s - 18513918 in 5.006723s
344
+
345
+ </pre>
346
+ </div>
347
+ <p>Please see the benchmark/ips <a href="https://github.com/evanphx/benchmark-ips/blob/master/README.md">README</a> for more information.</p><h4 id="running-tests">4.6 Running Tests</h4><p>It is not customary in Rails to run the full test suite before pushing
348
+ changes. The railties test suite in particular takes a long time, and even
349
+ more if the source code is mounted in <code>/vagrant</code> as happens in the recommended
350
+ workflow with the <a href="https://github.com/rails/rails-dev-box">rails-dev-box</a>.</p><p>As a compromise, test what your code obviously affects, and if the change is
351
+ not in railties, run the whole test suite of the affected component. If all
352
+ tests are passing, that's enough to propose your contribution. We have
353
+ <a href="https://travis-ci.org/rails/rails">Travis CI</a> as a safety net for catching
354
+ unexpected breakages elsewhere.</p><h5 id="entire-rails:">4.6.1 Entire Rails:</h5><p>To run all the tests, do:</p><div class="code_container">
355
+ <pre class="brush: plain; gutter: false; toolbar: false">
356
+ $ cd rails
357
+ $ bundle exec rake test
358
+
359
+ </pre>
360
+ </div>
361
+ <h5 id="for-a-particular-component">4.6.2 For a Particular Component</h5><p>You can run tests only for a particular component (e.g. Action Pack). For example,
362
+ to run Action Mailer tests:</p><div class="code_container">
363
+ <pre class="brush: plain; gutter: false; toolbar: false">
364
+ $ cd actionmailer
365
+ $ bundle exec rake test
366
+
367
+ </pre>
368
+ </div>
369
+ <h5 id="running-a-single-test">4.6.3 Running a Single Test</h5><p>You can run a single test through ruby. For instance:</p><div class="code_container">
370
+ <pre class="brush: plain; gutter: false; toolbar: false">
371
+ $ cd actionmailer
372
+ $ ruby -w -Itest test/mail_layout_test.rb -n test_explicit_class_layout
373
+
374
+ </pre>
375
+ </div>
376
+ <p>The <code>-n</code> option allows you to run a single method instead of the whole
377
+ file.</p><h6 id="testing-active-record">4.6.3.1 Testing Active Record</h6><p>This is how you run the Active Record test suite only for SQLite3:</p><div class="code_container">
378
+ <pre class="brush: plain; gutter: false; toolbar: false">
379
+ $ cd activerecord
380
+ $ bundle exec rake test:sqlite3
381
+
382
+ </pre>
383
+ </div>
384
+ <p>You can now run the tests as you did for <code>sqlite3</code>. The tasks are respectively</p><div class="code_container">
385
+ <pre class="brush: plain; gutter: false; toolbar: false">
386
+ test:mysql
387
+ test:mysql2
388
+ test:postgresql
389
+
390
+ </pre>
391
+ </div>
392
+ <p>Finally,</p><div class="code_container">
393
+ <pre class="brush: plain; gutter: false; toolbar: false">
394
+ $ bundle exec rake test
395
+
396
+ </pre>
397
+ </div>
398
+ <p>will now run the four of them in turn.</p><p>You can also run any single test separately:</p><div class="code_container">
399
+ <pre class="brush: plain; gutter: false; toolbar: false">
400
+ $ ARCONN=sqlite3 ruby -Itest test/cases/associations/has_many_associations_test.rb
401
+
402
+ </pre>
403
+ </div>
404
+ <p>To run a single test against all adapters, use:</p><div class="code_container">
405
+ <pre class="brush: plain; gutter: false; toolbar: false">
406
+ $ bundle exec rake TEST=test/cases/associations/has_many_associations_test.rb
407
+
408
+ </pre>
409
+ </div>
410
+ <p>You can invoke <code>test_jdbcmysql</code>, <code>test_jdbcsqlite3</code> or <code>test_jdbcpostgresql</code> also. See the file <code>activerecord/RUNNING_UNIT_TESTS.rdoc</code> for information on running more targeted database tests, or the file <code>ci/travis.rb</code> for the test suite run by the continuous integration server.</p><h4 id="warnings">4.7 Warnings</h4><p>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.</p><p>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:</p><div class="code_container">
411
+ <pre class="brush: plain; gutter: false; toolbar: false">
412
+ $ RUBYOPT=-W0 bundle exec rake test
413
+
414
+ </pre>
415
+ </div>
416
+ <h4 id="updating-the-changelog">4.8 Updating the CHANGELOG</h4><p>The CHANGELOG is an important part of every release. It keeps the list of changes for every Rails version.</p><p>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.</p><p>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:</p><div class="code_container">
417
+ <pre class="brush: plain; gutter: false; toolbar: false">
418
+ * Summary of a change that briefly describes what was changed. You can use multiple
419
+ lines and wrap them at around 80 characters. Code examples are ok, too, if needed:
420
+
421
+ class Foo
422
+ def bar
423
+ puts 'baz'
424
+ end
425
+ end
426
+
427
+ You can continue after the code example and you can attach issue number. GH#1234
428
+
429
+ *Your Name*
430
+
431
+ </pre>
432
+ </div>
433
+ <p>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.</p><h4 id="sanity-check">4.9 Sanity Check</h4><p>You should not be the only person who looks at the code before you submit it.
434
+ If you know someone else who uses Rails, try asking them if they'll check out
435
+ your work. If you don't know anyone else using Rails, try hopping into the IRC
436
+ room or posting about your idea to the rails-core mailing list. Doing this in
437
+ private before you push a patch out publicly is the "smoke test" for a patch:
438
+ if you can't convince one other developer of the beauty of your code, you’re
439
+ unlikely to convince the core team either.</p><h4 id="commit-your-changes">4.10 Commit Your Changes</h4><p>When you're happy with the code on your computer, you need to commit the changes to Git:</p><div class="code_container">
440
+ <pre class="brush: plain; gutter: false; toolbar: false">
441
+ $ git commit -a
442
+
443
+ </pre>
444
+ </div>
445
+ <p>At this point, your editor should be fired up and you can write a message for this commit. Well formatted and descriptive commit messages are extremely helpful for the others, especially when figuring out why given change was made, so please take the time to write it.</p><p>Good commit message should be formatted according to the following example:</p><div class="code_container">
446
+ <pre class="brush: plain; gutter: false; toolbar: false">
447
+ Short summary (ideally 50 characters or less)
448
+
449
+ More detailed description, if necessary. It should be wrapped to 72
450
+ characters. Try to be as descriptive as you can, even if you think that
451
+ the commit content is obvious, it may not be obvious to others. You
452
+ should add such description also if it's already present in bug tracker,
453
+ it should not be necessary to visit a webpage to check the history.
454
+
455
+ Description can have multiple paragraphs and you can use code examples
456
+ inside, just indent it with 4 spaces:
457
+
458
+ class ArticlesController
459
+ def index
460
+ render json: Article.limit(10)
461
+ end
462
+ end
463
+
464
+ You can also add bullet points:
465
+
466
+ - you can use dashes or asterisks
467
+
468
+ - also, try to indent next line of a point for readability, if it's too
469
+ long to fit in 72 characters
470
+
471
+ </pre>
472
+ </div>
473
+ <div class="info"><p>Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.</p></div><h4 id="update-your-branch">4.11 Update Your Branch</h4><p>It's pretty likely that other changes to master have happened while you were working. Go get them:</p><div class="code_container">
474
+ <pre class="brush: plain; gutter: false; toolbar: false">
475
+ $ git checkout master
476
+ $ git pull --rebase
477
+
478
+ </pre>
479
+ </div>
480
+ <p>Now reapply your patch on top of the latest changes:</p><div class="code_container">
481
+ <pre class="brush: plain; gutter: false; toolbar: false">
482
+ $ git checkout my_new_branch
483
+ $ git rebase master
484
+
485
+ </pre>
486
+ </div>
487
+ <p>No conflicts? Tests still pass? Change still seems reasonable to you? Then move on.</p><h4 id="fork">4.12 Fork</h4><p>Navigate to the Rails <a href="https://github.com/rails/rails">GitHub repository</a> and press "Fork" in the upper right hand corner.</p><p>Add the new remote to your local repository on your local machine:</p><div class="code_container">
488
+ <pre class="brush: plain; gutter: false; toolbar: false">
489
+ $ git remote add mine git@github.com:&lt;your user name&gt;/rails.git
490
+
491
+ </pre>
492
+ </div>
493
+ <p>Push to your remote:</p><div class="code_container">
494
+ <pre class="brush: plain; gutter: false; toolbar: false">
495
+ $ git push mine my_new_branch
496
+
497
+ </pre>
498
+ </div>
499
+ <p>You might have cloned your forked repository into your machine and might want to add the original Rails repository as a remote instead, if that's the case here's what you have to do.</p><p>In the directory you cloned your fork:</p><div class="code_container">
500
+ <pre class="brush: plain; gutter: false; toolbar: false">
501
+ $ git remote add rails git://github.com/rails/rails.git
502
+
503
+ </pre>
504
+ </div>
505
+ <p>Download new commits and branches from the official repository:</p><div class="code_container">
506
+ <pre class="brush: plain; gutter: false; toolbar: false">
507
+ $ git fetch rails
508
+
509
+ </pre>
510
+ </div>
511
+ <p>Merge the new content:</p><div class="code_container">
512
+ <pre class="brush: plain; gutter: false; toolbar: false">
513
+ $ git checkout master
514
+ $ git rebase rails/master
515
+
516
+ </pre>
517
+ </div>
518
+ <p>Update your fork:</p><div class="code_container">
519
+ <pre class="brush: plain; gutter: false; toolbar: false">
520
+ $ git push origin master
521
+
522
+ </pre>
523
+ </div>
524
+ <p>If you want to update another branch:</p><div class="code_container">
525
+ <pre class="brush: plain; gutter: false; toolbar: false">
526
+ $ git checkout branch_name
527
+ $ git rebase rails/branch_name
528
+ $ git push origin branch_name
529
+
530
+ </pre>
531
+ </div>
532
+ <h4 id="issue-a-pull-request">4.13 Issue a Pull Request</h4><p>Navigate to the Rails repository you just pushed to (e.g.
533
+ <a href="https://github.com/your-user-name/rails">https://github.com/your-user-name/rails</a>) and click on "Pull Requests" seen in
534
+ the right panel. On the next page, press "New pull request" in the upper right
535
+ hand corner.</p><p>Click on "Edit", if you need to change the branches being compared (it compares
536
+ "master" by default) and press "Click to create a pull request for this
537
+ comparison".</p><p>Ensure the changesets you introduced are included. Fill in some details about
538
+ your potential patch including a meaningful title. When finished, press "Send
539
+ pull request". The Rails core team will be notified about your submission.</p><h4 id="get-some-feedback">4.14 Get some Feedback</h4><p>Most pull requests will go through a few iterations before they get merged.
540
+ Different contributors will sometimes have different opinions, and often
541
+ patches will need revised before they can get merged.</p><p>Some contributors to Rails have email notifications from GitHub turned on, but
542
+ others do not. Furthermore, (almost) everyone who works on Rails is a
543
+ volunteer, and so it may take a few days for you to get your first feedback on
544
+ a pull request. Don't despair! Sometimes it's quick, sometimes it's slow. Such
545
+ is the open source life.</p><p>If it's been over a week, and you haven't heard anything, you might want to try
546
+ and nudge things along. You can use the <a href="http://groups.google.com/group/rubyonrails-core/">rubyonrails-core mailing
547
+ list</a> for this. You can also
548
+ leave another comment on the pull request.</p><p>While you're waiting for feedback on your pull request, open up a few other
549
+ pull requests and give someone else some! I'm sure they'll appreciate it in
550
+ the same way that you appreciate feedback on your patches.</p><h4 id="iterate-as-necessary">4.15 Iterate as Necessary</h4><p>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.</p><h5 id="squashing-commits">4.15.1 Squashing commits</h5><p>One of the things that we may ask you to do is to "squash your commits", which
551
+ will combine all of your commits into a single commit. We prefer pull requests
552
+ that are a single commit. This makes it easier to backport changes to stable
553
+ branches, squashing makes it easier to revert bad commits, and the git history
554
+ can be a bit easier to follow. Rails is a large project, and a bunch of
555
+ extraneous commits can add a lot of noise.</p><p>In order to do this, you'll need to have a git remote that points at the main
556
+ Rails repository. This is useful anyway, but just in case you don't have it set
557
+ up, make sure that you do this first:</p><div class="code_container">
558
+ <pre class="brush: plain; gutter: false; toolbar: false">
559
+ $ git remote add upstream https://github.com/rails/rails.git
560
+
561
+ </pre>
562
+ </div>
563
+ <p>You can call this remote whatever you'd like, but if you don't use <code>upstream</code>,
564
+ then change the name to your own in the instructions below.</p><p>Given that your remote branch is called <code>my_pull_request</code>, then you can do the
565
+ following:</p><div class="code_container">
566
+ <pre class="brush: plain; gutter: false; toolbar: false">
567
+ $ git fetch upstream
568
+ $ git checkout my_pull_request
569
+ $ git rebase upstream/master
570
+ $ git rebase -i
571
+
572
+ &lt; Choose 'squash' for all of your commits except the first one. &gt;
573
+ &lt; Edit the commit message to make sense, and describe all your changes. &gt;
574
+
575
+ $ git push origin my_pull_request -f
576
+
577
+ </pre>
578
+ </div>
579
+ <p>You should be able to refresh the pull request on GitHub and see that it has
580
+ been updated.</p><h4 id="older-versions-of-ruby-on-rails">4.16 Older Versions of Ruby on Rails</h4><p>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:</p><div class="code_container">
581
+ <pre class="brush: plain; gutter: false; toolbar: false">
582
+ $ git branch --track 4-0-stable origin/4-0-stable
583
+ $ git checkout 4-0-stable
584
+
585
+ </pre>
586
+ </div>
587
+ <div class="info"><p>You may want to <a href="http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/">put your Git branch name in your shell prompt</a> to make it easier to remember which version of the code you're working with.</p></div><h5 id="backporting">4.16.1 Backporting</h5><p>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.</p><p>For simple fixes, the easiest way to backport your changes is to <a href="http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git">extract a diff from your changes in master and apply them to the target branch</a>.</p><p>First make sure your changes are the only difference between your current branch and master:</p><div class="code_container">
588
+ <pre class="brush: plain; gutter: false; toolbar: false">
589
+ $ git log master..HEAD
590
+
591
+ </pre>
592
+ </div>
593
+ <p>Then extract the diff:</p><div class="code_container">
594
+ <pre class="brush: plain; gutter: false; toolbar: false">
595
+ $ git format-patch master --stdout &gt; ~/my_changes.patch
596
+
597
+ </pre>
598
+ </div>
599
+ <p>Switch over to the target branch and apply your changes:</p><div class="code_container">
600
+ <pre class="brush: plain; gutter: false; toolbar: false">
601
+ $ git checkout -b my_backport_branch 3-2-stable
602
+ $ git apply ~/my_changes.patch
603
+
604
+ </pre>
605
+ </div>
606
+ <p>This works well for simple changes. However, if your changes are complicated or if the code in master has deviated significantly from your target branch, it might require more work on your part. The difficulty of a backport varies greatly from case to case, and sometimes it is simply not worth the effort.</p><p>Once you have resolved all conflicts and made sure all the tests are passing, push your changes and open a separate pull request for your backport. It is also worth noting that older branches might have a different set of build targets than master. When possible, it is best to first test your backport locally against the Ruby versions listed in <code>.travis.yml</code> before submitting your pull request.</p><p>And then... think about your next contribution!</p><h3 id="rails-contributors">5 Rails Contributors</h3><p>All contributions, either via master or docrails, get credit in <a href="http://contributors.rubyonrails.org">Rails Contributors</a>.</p>
607
+
608
+ <h3>Feedback</h3>
609
+ <p>
610
+ You're encouraged to help improve the quality of this guide.
611
+ </p>
612
+ <p>
613
+ Please contribute if you see any typos or factual errors.
614
+ To get started, you can read our <a href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation">documentation contributions</a> section.
615
+ </p>
616
+ <p>
617
+ You may also find incomplete content, or stuff that is not up to date.
618
+ Please do add any missing documentation for master. Make sure to check
619
+ <a href="http://edgeguides.rubyonrails.org">Edge Guides</a> first to verify
620
+ if the issues are already fixed or not on the master branch.
621
+ Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
622
+ for style and conventions.
623
+ </p>
624
+ <p>
625
+ If for whatever reason you spot something to fix but cannot patch it yourself, please
626
+ <a href="https://github.com/rails/rails/issues">open an issue</a>.
627
+ </p>
628
+ <p>And last but not least, any kind of discussion regarding Ruby on Rails
629
+ documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
630
+ </p>
631
+ </div>
632
+ </div>
633
+ </div>
634
+
635
+ <hr class="hide" />
636
+ <div id="footer">
637
+ <div class="wrapper">
638
+ <p>This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a> License</p>
639
+ <p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
640
+
641
+ </div>
642
+ </div>
643
+
644
+ <script type="text/javascript" src="javascripts/jquery.min.js"></script>
645
+ <script type="text/javascript" src="javascripts/responsive-tables.js"></script>
646
+ <script type="text/javascript" src="javascripts/guides.js"></script>
647
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
648
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
649
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
650
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
651
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
652
+ <script type="text/javascript">
653
+ SyntaxHighlighter.all();
654
+ $(guidesIndex.bind);
655
+ </script>
656
+ </body>
657
+ </html>