rails 4.2.0.beta4 → 4.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/guides/Rakefile +3 -1
  3. data/guides/bug_report_templates/action_controller_gem.rb +2 -2
  4. data/guides/bug_report_templates/action_controller_master.rb +2 -2
  5. data/guides/source/3_0_release_notes.md +2 -2
  6. data/guides/source/4_1_release_notes.md +1 -1
  7. data/guides/source/4_2_release_notes.md +250 -225
  8. data/guides/source/_welcome.html.erb +1 -1
  9. data/guides/source/action_controller_overview.md +6 -6
  10. data/guides/source/action_mailer_basics.md +26 -11
  11. data/guides/source/action_view_overview.md +0 -1
  12. data/guides/source/active_job_basics.md +29 -23
  13. data/guides/source/active_record_postgresql.md +2 -7
  14. data/guides/source/active_record_validations.md +1 -0
  15. data/guides/source/active_support_core_extensions.md +1 -1
  16. data/guides/source/active_support_instrumentation.md +5 -5
  17. data/guides/source/asset_pipeline.md +2 -2
  18. data/guides/source/association_basics.md +0 -2
  19. data/guides/source/command_line.md +6 -15
  20. data/guides/source/configuring.md +4 -4
  21. data/guides/source/documents.yaml +0 -1
  22. data/guides/source/engines.md +26 -15
  23. data/guides/source/form_helpers.md +10 -2
  24. data/guides/source/getting_started.md +9 -9
  25. data/guides/source/rails_on_rack.md +2 -2
  26. data/guides/source/ruby_on_rails_guides_guidelines.md +1 -0
  27. data/guides/source/security.md +1 -1
  28. data/guides/source/testing.md +80 -13
  29. data/guides/source/upgrading_ruby_on_rails.md +23 -20
  30. metadata +29 -229
  31. data/guides/output/2_2_release_notes.html +0 -724
  32. data/guides/output/2_3_release_notes.html +0 -870
  33. data/guides/output/3_0_release_notes.html +0 -773
  34. data/guides/output/3_1_release_notes.html +0 -740
  35. data/guides/output/3_2_release_notes.html +0 -797
  36. data/guides/output/4_0_release_notes.html +0 -523
  37. data/guides/output/4_1_release_notes.html +0 -806
  38. data/guides/output/4_2_release_notes.html +0 -728
  39. data/guides/output/Gemfile +0 -6
  40. data/guides/output/_license.html +0 -226
  41. data/guides/output/_welcome.html +0 -233
  42. data/guides/output/action_controller_overview.html +0 -1335
  43. data/guides/output/action_mailer_basics.html +0 -928
  44. data/guides/output/action_view_overview.html +0 -1509
  45. data/guides/output/active_job_basics.html +0 -546
  46. data/guides/output/active_model_basics.html +0 -438
  47. data/guides/output/active_record_basics.html +0 -594
  48. data/guides/output/active_record_callbacks.html +0 -592
  49. data/guides/output/active_record_migrations.html +0 -1123
  50. data/guides/output/active_record_postgresql.html +0 -675
  51. data/guides/output/active_record_querying.html +0 -1796
  52. data/guides/output/active_record_validations.html +0 -1301
  53. data/guides/output/active_support_core_extensions.html +0 -3450
  54. data/guides/output/active_support_instrumentation.html +0 -1121
  55. data/guides/output/api_documentation_guidelines.html +0 -498
  56. data/guides/output/asset_pipeline.html +0 -1167
  57. data/guides/output/association_basics.html +0 -2086
  58. data/guides/output/caching_with_rails.html +0 -553
  59. data/guides/output/command_line.html +0 -791
  60. data/guides/output/configuring.html +0 -1055
  61. data/guides/output/contributing_to_ruby_on_rails.html +0 -657
  62. data/guides/output/credits.html +0 -284
  63. data/guides/output/debugging_rails_applications.html +0 -1014
  64. data/guides/output/development_dependencies_install.html +0 -478
  65. data/guides/output/engines.html +0 -1438
  66. data/guides/output/form_helpers.html +0 -1074
  67. data/guides/output/generators.html +0 -838
  68. data/guides/output/getting_started.html +0 -2092
  69. data/guides/output/i18n.html +0 -1198
  70. data/guides/output/images/akshaysurve.jpg +0 -0
  71. data/guides/output/images/belongs_to.png +0 -0
  72. data/guides/output/images/book_icon.gif +0 -0
  73. data/guides/output/images/bullet.gif +0 -0
  74. data/guides/output/images/chapters_icon.gif +0 -0
  75. data/guides/output/images/check_bullet.gif +0 -0
  76. data/guides/output/images/credits_pic_blank.gif +0 -0
  77. data/guides/output/images/csrf.png +0 -0
  78. data/guides/output/images/edge_badge.png +0 -0
  79. data/guides/output/images/favicon.ico +0 -0
  80. data/guides/output/images/feature_tile.gif +0 -0
  81. data/guides/output/images/footer_tile.gif +0 -0
  82. data/guides/output/images/fxn.png +0 -0
  83. data/guides/output/images/getting_started/article_with_comments.png +0 -0
  84. data/guides/output/images/getting_started/challenge.png +0 -0
  85. data/guides/output/images/getting_started/confirm_dialog.png +0 -0
  86. data/guides/output/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
  87. data/guides/output/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
  88. data/guides/output/images/getting_started/form_with_errors.png +0 -0
  89. data/guides/output/images/getting_started/index_action_with_edit_link.png +0 -0
  90. data/guides/output/images/getting_started/new_article.png +0 -0
  91. data/guides/output/images/getting_started/new_post.png +0 -0
  92. data/guides/output/images/getting_started/post_with_comments.png +0 -0
  93. data/guides/output/images/getting_started/rails_welcome.png +0 -0
  94. data/guides/output/images/getting_started/routing_error_no_controller.png +0 -0
  95. data/guides/output/images/getting_started/routing_error_no_route_matches.png +0 -0
  96. data/guides/output/images/getting_started/show_action_for_articles.png +0 -0
  97. data/guides/output/images/getting_started/show_action_for_posts.png +0 -0
  98. data/guides/output/images/getting_started/template_is_missing_articles_new.png +0 -0
  99. data/guides/output/images/getting_started/template_is_missing_posts_new.png +0 -0
  100. data/guides/output/images/getting_started/undefined_method_post_path.png +0 -0
  101. data/guides/output/images/getting_started/unknown_action_create_for_articles.png +0 -0
  102. data/guides/output/images/getting_started/unknown_action_create_for_posts.png +0 -0
  103. data/guides/output/images/getting_started/unknown_action_new_for_articles.png +0 -0
  104. data/guides/output/images/getting_started/unknown_action_new_for_posts.png +0 -0
  105. data/guides/output/images/grey_bullet.gif +0 -0
  106. data/guides/output/images/habtm.png +0 -0
  107. data/guides/output/images/has_many.png +0 -0
  108. data/guides/output/images/has_many_through.png +0 -0
  109. data/guides/output/images/has_one.png +0 -0
  110. data/guides/output/images/has_one_through.png +0 -0
  111. data/guides/output/images/header_backdrop.png +0 -0
  112. data/guides/output/images/header_tile.gif +0 -0
  113. data/guides/output/images/i18n/demo_html_safe.png +0 -0
  114. data/guides/output/images/i18n/demo_localized_pirate.png +0 -0
  115. data/guides/output/images/i18n/demo_translated_en.png +0 -0
  116. data/guides/output/images/i18n/demo_translated_pirate.png +0 -0
  117. data/guides/output/images/i18n/demo_translation_missing.png +0 -0
  118. data/guides/output/images/i18n/demo_untranslated.png +0 -0
  119. data/guides/output/images/icons/README +0 -5
  120. data/guides/output/images/icons/callouts/1.png +0 -0
  121. data/guides/output/images/icons/callouts/10.png +0 -0
  122. data/guides/output/images/icons/callouts/11.png +0 -0
  123. data/guides/output/images/icons/callouts/12.png +0 -0
  124. data/guides/output/images/icons/callouts/13.png +0 -0
  125. data/guides/output/images/icons/callouts/14.png +0 -0
  126. data/guides/output/images/icons/callouts/15.png +0 -0
  127. data/guides/output/images/icons/callouts/2.png +0 -0
  128. data/guides/output/images/icons/callouts/3.png +0 -0
  129. data/guides/output/images/icons/callouts/4.png +0 -0
  130. data/guides/output/images/icons/callouts/5.png +0 -0
  131. data/guides/output/images/icons/callouts/6.png +0 -0
  132. data/guides/output/images/icons/callouts/7.png +0 -0
  133. data/guides/output/images/icons/callouts/8.png +0 -0
  134. data/guides/output/images/icons/callouts/9.png +0 -0
  135. data/guides/output/images/icons/caution.png +0 -0
  136. data/guides/output/images/icons/example.png +0 -0
  137. data/guides/output/images/icons/home.png +0 -0
  138. data/guides/output/images/icons/important.png +0 -0
  139. data/guides/output/images/icons/next.png +0 -0
  140. data/guides/output/images/icons/note.png +0 -0
  141. data/guides/output/images/icons/prev.png +0 -0
  142. data/guides/output/images/icons/tip.png +0 -0
  143. data/guides/output/images/icons/up.png +0 -0
  144. data/guides/output/images/icons/warning.png +0 -0
  145. data/guides/output/images/nav_arrow.gif +0 -0
  146. data/guides/output/images/oscardelben.jpg +0 -0
  147. data/guides/output/images/polymorphic.png +0 -0
  148. data/guides/output/images/radar.png +0 -0
  149. data/guides/output/images/rails4_features.png +0 -0
  150. data/guides/output/images/rails_guides_kindle_cover.jpg +0 -0
  151. data/guides/output/images/rails_guides_logo.gif +0 -0
  152. data/guides/output/images/rails_logo_remix.gif +0 -0
  153. data/guides/output/images/session_fixation.png +0 -0
  154. data/guides/output/images/tab_grey.gif +0 -0
  155. data/guides/output/images/tab_info.gif +0 -0
  156. data/guides/output/images/tab_note.gif +0 -0
  157. data/guides/output/images/tab_red.gif +0 -0
  158. data/guides/output/images/tab_yellow.gif +0 -0
  159. data/guides/output/images/tab_yellow.png +0 -0
  160. data/guides/output/images/vijaydev.jpg +0 -0
  161. data/guides/output/index.html +0 -354
  162. data/guides/output/initialization.html +0 -876
  163. data/guides/output/javascripts/guides.js +0 -59
  164. data/guides/output/javascripts/jquery.min.js +0 -4
  165. data/guides/output/javascripts/responsive-tables.js +0 -43
  166. data/guides/output/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
  167. data/guides/output/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
  168. data/guides/output/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
  169. data/guides/output/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
  170. data/guides/output/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
  171. data/guides/output/javascripts/syntaxhighlighter/shBrushCpp.js +0 -97
  172. data/guides/output/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
  173. data/guides/output/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
  174. data/guides/output/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
  175. data/guides/output/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
  176. data/guides/output/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
  177. data/guides/output/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
  178. data/guides/output/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
  179. data/guides/output/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
  180. data/guides/output/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
  181. data/guides/output/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
  182. data/guides/output/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
  183. data/guides/output/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
  184. data/guides/output/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
  185. data/guides/output/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
  186. data/guides/output/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
  187. data/guides/output/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
  188. data/guides/output/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
  189. data/guides/output/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
  190. data/guides/output/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
  191. data/guides/output/javascripts/syntaxhighlighter/shCore.js +0 -17
  192. data/guides/output/layout.html +0 -448
  193. data/guides/output/layouts_and_rendering.html +0 -1541
  194. data/guides/output/maintenance_policy.html +0 -257
  195. data/guides/output/migrations.html +0 -1360
  196. data/guides/output/nested_model_forms.html +0 -412
  197. data/guides/output/plugins.html +0 -644
  198. data/guides/output/rails_application_templates.html +0 -450
  199. data/guides/output/rails_on_rack.html +0 -547
  200. data/guides/output/routing.html +0 -1631
  201. data/guides/output/ruby_on_rails_guides_guidelines.html +0 -329
  202. data/guides/output/security.html +0 -935
  203. data/guides/output/stylesheets/fixes.css +0 -16
  204. data/guides/output/stylesheets/kindle.css +0 -11
  205. data/guides/output/stylesheets/main.css +0 -713
  206. data/guides/output/stylesheets/print.css +0 -52
  207. data/guides/output/stylesheets/reset.css +0 -43
  208. data/guides/output/stylesheets/responsive-tables.css +0 -50
  209. data/guides/output/stylesheets/style.css +0 -13
  210. data/guides/output/stylesheets/syntaxhighlighter/shCore.css +0 -226
  211. data/guides/output/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
  212. data/guides/output/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
  213. data/guides/output/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
  214. data/guides/output/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
  215. data/guides/output/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
  216. data/guides/output/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
  217. data/guides/output/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
  218. data/guides/output/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
  219. data/guides/output/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
  220. data/guides/output/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
  221. data/guides/output/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
  222. data/guides/output/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
  223. data/guides/output/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
  224. data/guides/output/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
  225. data/guides/output/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
  226. data/guides/output/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
  227. data/guides/output/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +0 -116
  228. data/guides/output/testing.html +0 -1350
  229. data/guides/output/upgrading_ruby_on_rails.html +0 -1135
  230. data/guides/output/working_with_javascript_in_rails.html +0 -587
@@ -1,284 +0,0 @@
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>Ruby on Rails Guides: Credits
9
- </title>
10
- <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
11
- <link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
12
-
13
- <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" />
14
- <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeRailsGuides.css" />
15
-
16
- <link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" />
17
-
18
- <link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
19
- </head>
20
- <body class="guide">
21
- <div id="topNav">
22
- <div class="wrapper">
23
- <strong class="more-info-label">More at <a href="http://rubyonrails.org/">rubyonrails.org:</a> </strong>
24
- <span class="red-button more-info-button">
25
- More Ruby on Rails
26
- </span>
27
- <ul class="more-info-links s-hidden">
28
- <li class="more-info"><a href="http://rubyonrails.org/">Overview</a></li>
29
- <li class="more-info"><a href="http://rubyonrails.org/download">Download</a></li>
30
- <li class="more-info"><a href="http://rubyonrails.org/deploy">Deploy</a></li>
31
- <li class="more-info"><a href="https://github.com/rails/rails">Code</a></li>
32
- <li class="more-info"><a href="http://rubyonrails.org/screencasts">Screencasts</a></li>
33
- <li class="more-info"><a href="http://rubyonrails.org/documentation">Documentation</a></li>
34
- <li class="more-info"><a href="http://rubyonrails.org/community">Community</a></li>
35
- <li class="more-info"><a href="http://weblog.rubyonrails.org/">Blog</a></li>
36
- </ul>
37
- </div>
38
- </div>
39
- <div id="header">
40
- <div class="wrapper clearfix">
41
- <h1><a href="index.html" title="Return to home page">Guides.rubyonrails.org</a></h1>
42
- <ul class="nav">
43
- <li><a class="nav-item" href="index.html">Home</a></li>
44
- <li class="guides-index guides-index-large">
45
- <a href="index.html" id="guidesMenu" class="guides-index-item nav-item">Guides Index</a>
46
- <div id="guides" class="clearfix" style="display: none;">
47
- <hr />
48
- <dl class="L">
49
- <dt>Start Here</dt>
50
- <dd><a href="getting_started.html">Getting Started with Rails</a></dd>
51
- <dt>Models</dt>
52
- <dd><a href="active_record_basics.html">Active Record Basics</a></dd>
53
- <dd><a href="active_record_migrations.html">Active Record Migrations</a></dd>
54
- <dd><a href="active_record_validations.html">Active Record Validations</a></dd>
55
- <dd><a href="active_record_callbacks.html">Active Record Callbacks</a></dd>
56
- <dd><a href="association_basics.html">Active Record Associations</a></dd>
57
- <dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
58
- <dt>Views</dt>
59
- <dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
60
- <dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
61
- <dt>Controllers</dt>
62
- <dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
63
- <dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
64
- </dl>
65
- <dl class="R">
66
- <dt>Digging Deeper</dt>
67
- <dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
68
- <dd><a href="i18n.html">Rails Internationalization API</a></dd>
69
- <dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
70
- <dd><a href="active_job_basics.html">Active Job Basics</a></dd>
71
- <dd><a href="security.html">Securing Rails Applications</a></dd>
72
- <dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
73
- <dd><a href="configuring.html">Configuring Rails Applications</a></dd>
74
- <dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd>
75
- <dd><a href="asset_pipeline.html">Asset Pipeline</a></dd>
76
- <dd><a href="working_with_javascript_in_rails.html">Working with JavaScript in Rails</a></dd>
77
- <dt>Extending Rails</dt>
78
- <dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
79
- <dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd>
80
- <dt>Contributing to Ruby on Rails</dt>
81
- <dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
82
- <dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
83
- <dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd>
84
- <dt>Maintenance Policy</dt>
85
- <dd><a href="maintenance_policy.html">Maintenance Policy</a></dd>
86
- <dt>Release Notes</dt>
87
- <dd><a href="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</a></dd>
88
- <dd><a href="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</a></dd>
89
- <dd><a href="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</a></dd>
90
- <dd><a href="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</a></dd>
91
- <dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</a></dd>
92
- <dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd>
93
- <dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd>
94
- <dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd>
95
- </dl>
96
- </div>
97
- </li>
98
- <li><a class="nav-item" href="contributing_to_ruby_on_rails.html">Contribute</a></li>
99
- <li><a class="nav-item" href="credits.html">Credits</a></li>
100
- <li class="guides-index guides-index-small">
101
- <select class="guides-index-item nav-item">
102
- <option value="index.html">Guides Index</option>
103
- <optgroup label="Start Here">
104
- <option value="getting_started.html">Getting Started with Rails</option>
105
- </optgroup>
106
- <optgroup label="Models">
107
- <option value="active_record_basics.html">Active Record Basics</option>
108
- <option value="active_record_migrations.html">Active Record Migrations</option>
109
- <option value="active_record_validations.html">Active Record Validations</option>
110
- <option value="active_record_callbacks.html">Active Record Callbacks</option>
111
- <option value="association_basics.html">Active Record Associations</option>
112
- <option value="active_record_querying.html">Active Record Query Interface</option>
113
- </optgroup>
114
- <optgroup label="Views">
115
- <option value="layouts_and_rendering.html">Layouts and Rendering in Rails</option>
116
- <option value="form_helpers.html">Action View Form Helpers</option>
117
- </optgroup>
118
- <optgroup label="Controllers">
119
- <option value="action_controller_overview.html">Action Controller Overview</option>
120
- <option value="routing.html">Rails Routing from the Outside In</option>
121
- </optgroup>
122
- <optgroup label="Digging Deeper">
123
- <option value="active_support_core_extensions.html">Active Support Core Extensions</option>
124
- <option value="i18n.html">Rails Internationalization API</option>
125
- <option value="action_mailer_basics.html">Action Mailer Basics</option>
126
- <option value="active_job_basics.html">Active Job Basics</option>
127
- <option value="security.html">Securing Rails Applications</option>
128
- <option value="debugging_rails_applications.html">Debugging Rails Applications</option>
129
- <option value="configuring.html">Configuring Rails Applications</option>
130
- <option value="command_line.html">Rails Command Line Tools and Rake Tasks</option>
131
- <option value="asset_pipeline.html">Asset Pipeline</option>
132
- <option value="working_with_javascript_in_rails.html">Working with JavaScript in Rails</option>
133
- </optgroup>
134
- <optgroup label="Extending Rails">
135
- <option value="rails_on_rack.html">Rails on Rack</option>
136
- <option value="generators.html">Creating and Customizing Rails Generators</option>
137
- </optgroup>
138
- <optgroup label="Contributing to Ruby on Rails">
139
- <option value="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</option>
140
- <option value="api_documentation_guidelines.html">API Documentation Guidelines</option>
141
- <option value="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</option>
142
- </optgroup>
143
- <optgroup label="Maintenance Policy">
144
- <option value="maintenance_policy.html">Maintenance Policy</option>
145
- </optgroup>
146
- <optgroup label="Release Notes">
147
- <option value="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</option>
148
- <option value="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</option>
149
- <option value="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</option>
150
- <option value="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</option>
151
- <option value="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</option>
152
- <option value="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</option>
153
- <option value="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</option>
154
- <option value="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</option>
155
- </optgroup>
156
- </select>
157
- </li>
158
- </ul>
159
- </div>
160
- </div>
161
- <hr class="hide" />
162
-
163
- <div id="feature">
164
- <div class="wrapper">
165
- <h2>Credits</h2>
166
-
167
- <p>We'd like to thank the following people for their tireless contributions to this project.</p>
168
-
169
-
170
-
171
-
172
- </div>
173
- </div>
174
-
175
- <div id="container">
176
- <div class="wrapper">
177
- <div id="mainCol">
178
-
179
-
180
- <h3 class="section">Rails Guides Reviewers</h3>
181
-
182
- <div class="clearfix" id="vijaydev"><img alt="Vijay Dev" class="left pic" height="91" src="images/vijaydev.jpg" width="91" /><h3>Vijay Dev</h3><p>
183
- Vijayakumar, found as Vijay Dev on the web, is a web applications developer and an open source enthusiast who lives in Chennai, India. He started using Rails in 2009 and began actively contributing to Rails documentation in late 2010. He <a href="https://twitter.com/vijay_dev">tweets</a> a lot and also <a href="http://vijaydev.wordpress.com">blogs</a>.
184
- </p></div>
185
- <div class="clearfix" id="fxn"><img alt="Xavier Noria" class="left pic" height="91" src="images/fxn.png" width="91" /><h3>Xavier Noria</h3><p>
186
- Xavier Noria has been into Ruby on Rails since 2005. He is a Rails core team member and enjoys combining his passion for Rails and his past life as a proofreader of math textbooks. Xavier is currently an independent Ruby on Rails consultant. Oh, he also <a href="http://twitter.com/fxn">tweets</a> and can be found everywhere as &quot;fxn&quot;.
187
- </p></div>
188
- <h3 class="section">Rails Guides Designers</h3>
189
-
190
- <div class="clearfix" id="jz"><img alt="Jason Zimdars" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Jason Zimdars</h3><p>
191
- Jason Zimdars is an experienced creative director and web designer who has lead UI and UX design for numerous websites and web applications. You can see more of his design and writing at <a href="http://www.thinkcage.com/">Thinkcage.com</a> or follow him on <a href="http://twitter.com/JZ">Twitter</a>.
192
- </p></div>
193
- <h3 class="section">Rails Guides Authors</h3>
194
-
195
- <div class="clearfix" id="radar"><img alt="Ryan Bigg" class="left pic" height="91" src="images/radar.png" width="91" /><h3>Ryan Bigg</h3><p>
196
- Ryan Bigg works as the Community Manager at <a href="http://spreecommerce.com">Spree Commerce</a> and has been working with Rails since 2006. He's the author of <a href="https://leanpub.com/multi-tenancy-rails">Multi Tenancy With Rails</a> and co-author of <a href="http://manning.com/bigg2">Rails 4 in Action</a>. He's written many gems which can be seen on <a href="https://github.com/radar">his GitHub page</a> and he also tweets prolifically as <a href="http://twitter.com/ryanbigg">@ryanbigg</a>.
197
- </p></div>
198
- <div class="clearfix" id="oscardelben"><img alt="Oscar Del Ben" class="left pic" height="91" src="images/oscardelben.jpg" width="91" /><h3>Oscar Del Ben</h3><p>
199
- Oscar Del Ben is a software engineer at <a href="http://www.wildfireapp.com/">Wildfire</a>. He's a regular open source contributor (<a href="https://github.com/oscardelben">GitHub account</a>) and tweets regularly at <a href="https://twitter.com/oscardelben">@oscardelben</a>.
200
- </p></div>
201
- <div class="clearfix" id="fcheung"><img alt="Frederick Cheung" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Frederick Cheung</h3><p>
202
- Frederick Cheung is Chief Wizard at Texperts where he has been using Rails since 2006. He is based in Cambridge (UK) and when not consuming fine ales he blogs at <a href="http://www.spacevatican.org">spacevatican.org</a>.
203
- </p></div>
204
- <div class="clearfix" id="toretore"><img alt="Tore Darell" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Tore Darell</h3><p>
205
- 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>.
206
- </p></div>
207
- <div class="clearfix" id="zilkey"><img alt="Jeff Dean" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Jeff Dean</h3><p>
208
- Jeff Dean is a software engineer with <a href="http://pivotallabs.com">Pivotal Labs</a>.
209
- </p></div>
210
- <div class="clearfix" id="mgunderloy"><img alt="Mike Gunderloy" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Mike Gunderloy</h3><p>
211
- Mike Gunderloy is a consultant with <a href="http://www.actionrails.com">ActionRails</a>. He brings 25 years of experience in a variety of languages to bear on his current work with Rails. His near-daily links and other blogging can be found at <a href="http://afreshcup.com">A Fresh Cup</a> and he <a href="http://twitter.com/MikeG1">twitters</a> too much.
212
- </p></div>
213
- <div class="clearfix" id="raasdnil"><img alt="Mikel Lindsaar" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Mikel Lindsaar</h3><p>
214
- Mikel Lindsaar has been working with Rails since 2006 and is the author of the Ruby <a href="https://github.com/mikel/mail">Mail gem</a> and core contributor (he helped re-write Action Mailer's API). Mikel is the founder of <a href="http://rubyx.com/">RubyX</a>, has a <a href="http://lindsaar.net/">blog</a> and <a href="http://twitter.com/raasdnil">tweets</a>.
215
- </p></div>
216
- <div class="clearfix" id="cmarques"><img alt="Cássio Marques" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Cássio Marques</h3><p>
217
- Cássio Marques is a Brazilian software developer working with different programming languages such as Ruby, JavaScript, CPP and Java, as an independent consultant. He blogs at <a href="http://cassiomarques.wordpress.com">/* CODIFICANDO */</a>, which is mainly written in Portuguese, but will soon get a new section for posts with English translation.
218
- </p></div>
219
- <div class="clearfix" id="bensie"><img alt="James Miller" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>James Miller</h3><p>
220
- James Miller is a software developer for <a href="http://www.jk-tech.com">JK Tech</a> in San Diego, CA. You can find James on GitHub, Gmail, Twitter, and Freenode as &quot;bensie&quot;.
221
- </p></div>
222
- <div class="clearfix" id="lifo"><img alt="Pratik Naik" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Pratik Naik</h3><p>
223
- 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>.
224
- </p></div>
225
- <div class="clearfix" id="miloops"><img alt="Emilio Tagua" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Emilio Tagua</h3><p>
226
- Emilio Tagua &mdash;a.k.a. miloops&mdash; is an Argentinian entrepreneur, developer, open source contributor and Rails evangelist. Cofounder of <a href="http://eventioz.com">Eventioz</a>. He has been using Rails since 2006 and contributing since early 2008. Can be found at gmail, twitter, freenode, everywhere as &quot;miloops&quot;.
227
- </p></div>
228
- <div class="clearfix" id="hawe"><img alt="Heiko Webers" class="left pic" height="91" src="images/credits_pic_blank.gif" width="91" /><h3>Heiko Webers</h3><p>
229
- Heiko Webers is the founder of <a href="http://www.bauland42.de">bauland42</a>, a German web application security consulting and development company focused on Ruby on Rails. He blogs at the <a href="http://www.rorsecurity.info">Ruby on Rails Security Project</a>. After 10 years of desktop application development, Heiko has rarely looked back.
230
- </p></div>
231
- <div class="clearfix" id="startupjockey"><img alt="Akshay Surve" class="left pic" height="91" src="images/akshaysurve.jpg" width="91" /><h3>Akshay Surve</h3><p>
232
- Akshay Surve is the Founder at <a href="http://www.deltax.com">DeltaX</a>, hackathon specialist, a midnight code junkie and occasionally writes prose. You can connect with him on <a href="https://twitter.com/akshaysurve">Twitter</a>, <a href="http://www.linkedin.com/in/akshaysurve">Linkedin</a>, <a href="http://www.akshaysurve.com/">Personal Blog</a> or <a href="http://www.quora.com/Akshay-Surve">Quora</a>.
233
- </p></div>
234
-
235
- <h3>Feedback</h3>
236
- <p>
237
- You're encouraged to help improve the quality of this guide.
238
- </p>
239
- <p>
240
- Please contribute if you see any typos or factual errors.
241
- 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.
242
- </p>
243
- <p>
244
- You may also find incomplete content, or stuff that is not up to date.
245
- Please do add any missing documentation for master. Make sure to check
246
- <a href="http://edgeguides.rubyonrails.org">Edge Guides</a> first to verify
247
- if the issues are already fixed or not on the master branch.
248
- Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
249
- for style and conventions.
250
- </p>
251
- <p>
252
- If for whatever reason you spot something to fix but cannot patch it yourself, please
253
- <a href="https://github.com/rails/rails/issues">open an issue</a>.
254
- </p>
255
- <p>And last but not least, any kind of discussion regarding Ruby on Rails
256
- documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
257
- </p>
258
- </div>
259
- </div>
260
- </div>
261
-
262
- <hr class="hide" />
263
- <div id="footer">
264
- <div class="wrapper">
265
- <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>
266
- <p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
267
-
268
- </div>
269
- </div>
270
-
271
- <script type="text/javascript" src="javascripts/jquery.min.js"></script>
272
- <script type="text/javascript" src="javascripts/responsive-tables.js"></script>
273
- <script type="text/javascript" src="javascripts/guides.js"></script>
274
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
275
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
276
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
277
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
278
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
279
- <script type="text/javascript">
280
- SyntaxHighlighter.all();
281
- $(guidesIndex.bind);
282
- </script>
283
- </body>
284
- </html>
@@ -1,1014 +0,0 @@
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>Debugging Rails Applications — 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>Debugging Rails Applications</h2><p>This guide introduces techniques for debugging Ruby on Rails applications.</p><p>After reading this guide, you will know:</p>
165
- <ul>
166
- <li>The purpose of debugging.</li>
167
- <li>How to track down problems and issues in your application that your tests aren&#39;t identifying.</li>
168
- <li>The different ways of debugging.</li>
169
- <li>How to analyze the stack trace.</li>
170
- </ul>
171
-
172
-
173
- <div id="subCol">
174
- <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
175
- <ol class="chapters">
176
- <li>
177
- <a href="#view-helpers-for-debugging">View Helpers for Debugging</a>
178
-
179
- <ul>
180
- <li><a href="#debug"><code>debug</code></a></li>
181
- <li><a href="#to_yaml"><code>to_yaml</code></a></li>
182
- <li><a href="#inspect"><code>inspect</code></a></li>
183
- </ul>
184
- </li>
185
- <li>
186
- <a href="#the-logger">The Logger</a>
187
-
188
- <ul>
189
- <li><a href="#what-is-the-logger-questionmark">What is the Logger?</a></li>
190
- <li><a href="#log-levels">Log Levels</a></li>
191
- <li><a href="#sending-messages">Sending Messages</a></li>
192
- <li><a href="#tagged-logging">Tagged Logging</a></li>
193
- <li><a href="#impact-of-logs-on-performance">Impact of Logs on Performance</a></li>
194
- </ul>
195
- </li>
196
- <li>
197
- <a href="#debugging-with-the-byebug-gem">Debugging with the <code>byebug</code> gem</a>
198
-
199
- <ul>
200
- <li><a href="#setup">Setup</a></li>
201
- <li><a href="#the-shell">The Shell</a></li>
202
- <li><a href="#the-context">The Context</a></li>
203
- <li><a href="#threads">Threads</a></li>
204
- <li><a href="#inspecting-variables">Inspecting Variables</a></li>
205
- <li><a href="#step-by-step">Step by Step</a></li>
206
- <li><a href="#breakpoints">Breakpoints</a></li>
207
- <li><a href="#catching-exceptions">Catching Exceptions</a></li>
208
- <li><a href="#resuming-execution">Resuming Execution</a></li>
209
- <li><a href="#editing">Editing</a></li>
210
- <li><a href="#quitting">Quitting</a></li>
211
- <li><a href="#settings">Settings</a></li>
212
- </ul>
213
- </li>
214
- <li>
215
- <a href="#debugging-memory-leaks">Debugging Memory Leaks</a>
216
-
217
- <ul>
218
- <li><a href="#valgrind">Valgrind</a></li>
219
- </ul>
220
- </li>
221
- <li><a href="#plugins-for-debugging">Plugins for Debugging</a></li>
222
- <li><a href="#references">References</a></li>
223
- </ol>
224
-
225
- </div>
226
-
227
- </div>
228
- </div>
229
-
230
- <div id="container">
231
- <div class="wrapper">
232
- <div id="mainCol">
233
- <h3 id="view-helpers-for-debugging">1 View Helpers for Debugging</h3><p>One common task is to inspect the contents of a variable. In Rails, you can do this with three methods:</p>
234
- <ul>
235
- <li><code>debug</code></li>
236
- <li><code>to_yaml</code></li>
237
- <li><code>inspect</code></li>
238
- </ul>
239
- <h4 id="debug">1.1 <code>debug</code>
240
- </h4><p>The <code>debug</code> helper will return a &lt;pre&gt; tag that renders the object using the YAML format. This will generate human-readable data from any object. For example, if you have this code in a view:</p><div class="code_container">
241
- <pre class="brush: plain; gutter: false; toolbar: false">
242
- &lt;%= debug @article %&gt;
243
- &lt;p&gt;
244
- &lt;b&gt;Title:&lt;/b&gt;
245
- &lt;%= @article.title %&gt;
246
- &lt;/p&gt;
247
-
248
- </pre>
249
- </div>
250
- <p>You'll see something like this:</p><div class="code_container">
251
- <pre class="brush: plain; gutter: false; toolbar: false">
252
- --- !ruby/object Article
253
- attributes:
254
- updated_at: 2008-09-05 22:55:47
255
- body: It's a very helpful guide for debugging your Rails app.
256
- title: Rails debugging guide
257
- published: t
258
- id: "1"
259
- created_at: 2008-09-05 22:55:47
260
- attributes_cache: {}
261
-
262
-
263
- Title: Rails debugging guide
264
-
265
- </pre>
266
- </div>
267
- <h4 id="to_yaml">1.2 <code>to_yaml</code>
268
- </h4><p>Displaying an instance variable, or any other object or method, in YAML format can be achieved this way:</p><div class="code_container">
269
- <pre class="brush: plain; gutter: false; toolbar: false">
270
- &lt;%= simple_format @article.to_yaml %&gt;
271
- &lt;p&gt;
272
- &lt;b&gt;Title:&lt;/b&gt;
273
- &lt;%= @article.title %&gt;
274
- &lt;/p&gt;
275
-
276
- </pre>
277
- </div>
278
- <p>The <code>to_yaml</code> method converts the method to YAML format leaving it more readable, and then the <code>simple_format</code> helper is used to render each line as in the console. This is how <code>debug</code> method does its magic.</p><p>As a result of this, you will have something like this in your view:</p><div class="code_container">
279
- <pre class="brush: plain; gutter: false; toolbar: false">
280
- --- !ruby/object Article
281
- attributes:
282
- updated_at: 2008-09-05 22:55:47
283
- body: It's a very helpful guide for debugging your Rails app.
284
- title: Rails debugging guide
285
- published: t
286
- id: "1"
287
- created_at: 2008-09-05 22:55:47
288
- attributes_cache: {}
289
-
290
- Title: Rails debugging guide
291
-
292
- </pre>
293
- </div>
294
- <h4 id="inspect">1.3 <code>inspect</code>
295
- </h4><p>Another useful method for displaying object values is <code>inspect</code>, especially when working with arrays or hashes. This will print the object value as a string. For example:</p><div class="code_container">
296
- <pre class="brush: plain; gutter: false; toolbar: false">
297
- &lt;%= [1, 2, 3, 4, 5].inspect %&gt;
298
- &lt;p&gt;
299
- &lt;b&gt;Title:&lt;/b&gt;
300
- &lt;%= @article.title %&gt;
301
- &lt;/p&gt;
302
-
303
- </pre>
304
- </div>
305
- <p>Will be rendered as follows:</p><div class="code_container">
306
- <pre class="brush: plain; gutter: false; toolbar: false">
307
- [1, 2, 3, 4, 5]
308
-
309
- Title: Rails debugging guide
310
-
311
- </pre>
312
- </div>
313
- <h3 id="the-logger">2 The Logger</h3><p>It can also be useful to save information to log files at runtime. Rails maintains a separate log file for each runtime environment.</p><h4 id="what-is-the-logger-questionmark">2.1 What is the Logger?</h4><p>Rails makes use of the <code>ActiveSupport::Logger</code> class to write log information. You can also substitute another logger such as <code>Log4r</code> if you wish.</p><p>You can specify an alternative logger in your <code>environment.rb</code> or any environment file:</p><div class="code_container">
314
- <pre class="brush: ruby; gutter: false; toolbar: false">
315
- Rails.logger = Logger.new(STDOUT)
316
- Rails.logger = Log4r::Logger.new("Application Log")
317
-
318
- </pre>
319
- </div>
320
- <p>Or in the <code>Initializer</code> section, add <em>any</em> of the following</p><div class="code_container">
321
- <pre class="brush: ruby; gutter: false; toolbar: false">
322
- config.logger = Logger.new(STDOUT)
323
- config.logger = Log4r::Logger.new("Application Log")
324
-
325
- </pre>
326
- </div>
327
- <div class="info"><p>By default, each log is created under <code>Rails.root/log/</code> and the log file is named after the environment in which the application is running.</p></div><h4 id="log-levels">2.2 Log Levels</h4><p>When something is logged it's printed into the corresponding log if the log level of the message is equal or higher than the configured log level. If you want to know the current log level you can call the <code>Rails.logger.level</code> method.</p><p>The available log levels are: <code>:debug</code>, <code>:info</code>, <code>:warn</code>, <code>:error</code>, <code>:fatal</code>, and <code>:unknown</code>, corresponding to the log level numbers from 0 up to 5 respectively. To change the default log level, use</p><div class="code_container">
328
- <pre class="brush: ruby; gutter: false; toolbar: false">
329
- config.log_level = :warn # In any environment initializer, or
330
- Rails.logger.level = 0 # at any time
331
-
332
- </pre>
333
- </div>
334
- <p>This is useful when you want to log under development or staging, but you don't want to flood your production log with unnecessary information.</p><div class="info"><p>The default Rails log level is <code>info</code> in production mode and <code>debug</code> in development and test mode.</p></div><h4 id="sending-messages">2.3 Sending Messages</h4><p>To write in the current log use the <code>logger.(debug|info|warn|error|fatal)</code> method from within a controller, model or mailer:</p><div class="code_container">
335
- <pre class="brush: ruby; gutter: false; toolbar: false">
336
- logger.debug "Person attributes hash: #{@person.attributes.inspect}"
337
- logger.info "Processing the request..."
338
- logger.fatal "Terminating application, raised unrecoverable error!!!"
339
-
340
- </pre>
341
- </div>
342
- <p>Here's an example of a method instrumented with extra logging:</p><div class="code_container">
343
- <pre class="brush: ruby; gutter: false; toolbar: false">
344
- class ArticlesController &lt; ApplicationController
345
- # ...
346
-
347
- def create
348
- @article = Article.new(params[:article])
349
- logger.debug "New article: #{@article.attributes.inspect}"
350
- logger.debug "Article should be valid: #{@article.valid?}"
351
-
352
- if @article.save
353
- flash[:notice] = 'Article was successfully created.'
354
- logger.debug "The article was saved and now the user is going to be redirected..."
355
- redirect_to(@article)
356
- else
357
- render action: "new"
358
- end
359
- end
360
-
361
- # ...
362
- end
363
-
364
- </pre>
365
- </div>
366
- <p>Here's an example of the log generated when this controller action is executed:</p><div class="code_container">
367
- <pre class="brush: plain; gutter: false; toolbar: false">
368
- Processing ArticlesController#create (for 127.0.0.1 at 2008-09-08 11:52:54) [POST]
369
- Session ID: BAh7BzoMY3NyZl9pZCIlMDY5MWU1M2I1ZDRjODBlMzkyMWI1OTg2NWQyNzViZjYiCmZsYXNoSUM6J0FjdGl
370
- vbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2VkewA=--b18cd92fba90eacf8137e5f6b3b06c4d724596a4
371
- Parameters: {"commit"=&gt;"Create", "article"=&gt;{"title"=&gt;"Debugging Rails",
372
- "body"=&gt;"I'm learning how to print in logs!!!", "published"=&gt;"0"},
373
- "authenticity_token"=&gt;"2059c1286e93402e389127b1153204e0d1e275dd", "action"=&gt;"create", "controller"=&gt;"articles"}
374
- New article: {"updated_at"=&gt;nil, "title"=&gt;"Debugging Rails", "body"=&gt;"I'm learning how to print in logs!!!",
375
- "published"=&gt;false, "created_at"=&gt;nil}
376
- Article should be valid: true
377
- Article Create (0.000443) INSERT INTO "articles" ("updated_at", "title", "body", "published",
378
- "created_at") VALUES('2008-09-08 14:52:54', 'Debugging Rails',
379
- 'I''m learning how to print in logs!!!', 'f', '2008-09-08 14:52:54')
380
- The article was saved and now the user is going to be redirected...
381
- Redirected to # Article:0x20af760&gt;
382
- Completed in 0.01224 (81 reqs/sec) | DB: 0.00044 (3%) | 302 Found [http://localhost/articles]
383
-
384
- </pre>
385
- </div>
386
- <p>Adding extra logging like this makes it easy to search for unexpected or unusual behavior in your logs. If you add extra logging, be sure to make sensible use of log levels to avoid filling your production logs with useless trivia.</p><h4 id="tagged-logging">2.4 Tagged Logging</h4><p>When running multi-user, multi-account applications, it's often useful
387
- to be able to filter the logs using some custom rules. <code>TaggedLogging</code>
388
- in Active Support helps in doing exactly that by stamping log lines with subdomains, request ids, and anything else to aid debugging such applications.</p><div class="code_container">
389
- <pre class="brush: ruby; gutter: false; toolbar: false">
390
- logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
391
- logger.tagged("BCX") { logger.info "Stuff" } # Logs "[BCX] Stuff"
392
- logger.tagged("BCX", "Jason") { logger.info "Stuff" } # Logs "[BCX] [Jason] Stuff"
393
- logger.tagged("BCX") { logger.tagged("Jason") { logger.info "Stuff" } } # Logs "[BCX] [Jason] Stuff"
394
-
395
- </pre>
396
- </div>
397
- <h4 id="impact-of-logs-on-performance">2.5 Impact of Logs on Performance</h4><p>Logging will always have a small impact on performance of your rails app,
398
- particularly when logging to disk.However, there are a few subtleties:</p><p>Using the <code>:debug</code> level will have a greater performance penalty than <code>:fatal</code>,
399
- as a far greater number of strings are being evaluated and written to the
400
- log output (e.g. disk).</p><p>Another potential pitfall is that if you have many calls to <code>Logger</code> like this
401
- in your code:</p><div class="code_container">
402
- <pre class="brush: ruby; gutter: false; toolbar: false">
403
- logger.debug "Person attributes hash: #{@person.attributes.inspect}"
404
-
405
- </pre>
406
- </div>
407
- <p>In the above example, There will be a performance impact even if the allowed
408
- output level doesn't include debug. The reason is that Ruby has to evaluate
409
- these strings, which includes instantiating the somewhat heavy <code>String</code> object
410
- and interpolating the variables, and which takes time.
411
- Therefore, it's recommended to pass blocks to the logger methods, as these are
412
- only evaluated if the output level is the same or included in the allowed level
413
- (i.e. lazy loading). The same code rewritten would be:</p><div class="code_container">
414
- <pre class="brush: ruby; gutter: false; toolbar: false">
415
- logger.debug {"Person attributes hash: #{@person.attributes.inspect}"}
416
-
417
- </pre>
418
- </div>
419
- <p>The contents of the block, and therefore the string interpolation, is only
420
- evaluated if debug is enabled. This performance savings is only really
421
- noticeable with large amounts of logging, but it's a good practice to employ.</p><h3 id="debugging-with-the-byebug-gem">3 Debugging with the <code>byebug</code> gem</h3><p>When your code is behaving in unexpected ways, you can try printing to logs or
422
- the console to diagnose the problem. Unfortunately, there are times when this
423
- sort of error tracking is not effective in finding the root cause of a problem.
424
- When you actually need to journey into your running source code, the debugger
425
- is your best companion.</p><p>The debugger can also help you if you want to learn about the Rails source code
426
- but don't know where to start. Just debug any request to your application and
427
- use this guide to learn how to move from the code you have written deeper into
428
- Rails code.</p><h4 id="setup">3.1 Setup</h4><p>You can use the <code>byebug</code> gem to set breakpoints and step through live code in
429
- Rails. To install it, just run:</p><div class="code_container">
430
- <pre class="brush: plain; gutter: false; toolbar: false">
431
- $ gem install byebug
432
-
433
- </pre>
434
- </div>
435
- <p>Inside any Rails application you can then invoke the debugger by calling the
436
- <code>byebug</code> method.</p><p>Here's an example:</p><div class="code_container">
437
- <pre class="brush: ruby; gutter: false; toolbar: false">
438
- class PeopleController &lt; ApplicationController
439
- def new
440
- byebug
441
- @person = Person.new
442
- end
443
- end
444
-
445
- </pre>
446
- </div>
447
- <h4 id="the-shell">3.2 The Shell</h4><p>As soon as your application calls the <code>byebug</code> method, the debugger will be
448
- started in a debugger shell inside the terminal window where you launched your
449
- application server, and you will be placed at the debugger's prompt <code>(byebug)</code>.
450
- Before the prompt, the code around the line that is about to be run will be
451
- displayed and the current line will be marked by '=&gt;'. Like this:</p><div class="code_container">
452
- <pre class="brush: plain; gutter: false; toolbar: false">
453
- [1, 10] in /PathTo/project/app/controllers/articles_controller.rb
454
- 3:
455
- 4: # GET /articles
456
- 5: # GET /articles.json
457
- 6: def index
458
- 7: byebug
459
- =&gt; 8: @articles = Article.find_recent
460
- 9:
461
- 10: respond_to do |format|
462
- 11: format.html # index.html.erb
463
- 12: format.json { render json: @articles }
464
-
465
- (byebug)
466
-
467
- </pre>
468
- </div>
469
- <p>If you got there by a browser request, the browser tab containing the request
470
- will be hung until the debugger has finished and the trace has finished
471
- processing the entire request.</p><p>For example:</p><div class="code_container">
472
- <pre class="brush: plain; gutter: false; toolbar: false">
473
- =&gt; Booting WEBrick
474
- =&gt; Rails 4.2.0 application starting in development on http://0.0.0.0:3000
475
- =&gt; Run `rails server -h` for more startup options
476
- =&gt; Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
477
- =&gt; Ctrl-C to shutdown server
478
- [2014-04-11 13:11:47] INFO WEBrick 1.3.1
479
- [2014-04-11 13:11:47] INFO ruby 2.1.1 (2014-02-24) [i686-linux]
480
- [2014-04-11 13:11:47] INFO WEBrick::HTTPServer#start: pid=6370 port=3000
481
-
482
-
483
- Started GET "/" for 127.0.0.1 at 2014-04-11 13:11:48 +0200
484
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
485
- Processing by ArticlesController#index as HTML
486
-
487
- [3, 12] in /PathTo/project/app/controllers/articles_controller.rb
488
- 3:
489
- 4: # GET /articles
490
- 5: # GET /articles.json
491
- 6: def index
492
- 7: byebug
493
- =&gt; 8: @articles = Article.find_recent
494
- 9:
495
- 10: respond_to do |format|
496
- 11: format.html # index.html.erb
497
- 12: format.json { render json: @articles }
498
-
499
- (byebug)
500
-
501
- </pre>
502
- </div>
503
- <p>Now it's time to explore and dig into your application. A good place to start is
504
- by asking the debugger for help. Type: <code>help</code></p><div class="code_container">
505
- <pre class="brush: plain; gutter: false; toolbar: false">
506
- (byebug) help
507
-
508
- byebug 2.7.0
509
-
510
- Type 'help &lt;command-name&gt;' for help on a specific command
511
-
512
- Available commands:
513
- backtrace delete enable help list pry next restart source up
514
- break disable eval info method ps save step var
515
- catch display exit interrupt next putl set thread
516
- condition down finish irb p quit show trace
517
- continue edit frame kill pp reload skip undisplay
518
-
519
- </pre>
520
- </div>
521
- <div class="info"><p>To view the help menu for any command use <code>help &lt;command-name&gt;</code> at the
522
- debugger prompt. For example: <em><code>help list</code></em>. You can abbreviate any debugging
523
- command by supplying just enough letters to distinguish them from other
524
- commands, so you can also use <code>l</code> for the <code>list</code> command, for example.</p></div><p>To see the previous ten lines you should type <code>list-</code> (or <code>l-</code>)</p><div class="code_container">
525
- <pre class="brush: plain; gutter: false; toolbar: false">
526
- (byebug) l-
527
-
528
- [1, 10] in /PathTo/project/app/controllers/articles_controller.rb
529
- 1 class ArticlesController &lt; ApplicationController
530
- 2 before_action :set_article, only: [:show, :edit, :update, :destroy]
531
- 3
532
- 4 # GET /articles
533
- 5 # GET /articles.json
534
- 6 def index
535
- 7 byebug
536
- 8 @articles = Article.find_recent
537
- 9
538
- 10 respond_to do |format|
539
-
540
-
541
- </pre>
542
- </div>
543
- <p>This way you can move inside the file, being able to see the code above and over
544
- the line where you added the <code>byebug</code> call. Finally, to see where you are in
545
- the code again you can type <code>list=</code></p><div class="code_container">
546
- <pre class="brush: plain; gutter: false; toolbar: false">
547
- (byebug) list=
548
-
549
- [3, 12] in /PathTo/project/app/controllers/articles_controller.rb
550
- 3:
551
- 4: # GET /articles
552
- 5: # GET /articles.json
553
- 6: def index
554
- 7: byebug
555
- =&gt; 8: @articles = Article.find_recent
556
- 9:
557
- 10: respond_to do |format|
558
- 11: format.html # index.html.erb
559
- 12: format.json { render json: @articles }
560
-
561
- (byebug)
562
-
563
- </pre>
564
- </div>
565
- <h4 id="the-context">3.3 The Context</h4><p>When you start debugging your application, you will be placed in different
566
- contexts as you go through the different parts of the stack.</p><p>The debugger creates a context when a stopping point or an event is reached. The
567
- context has information about the suspended program which enables the debugger
568
- to inspect the frame stack, evaluate variables from the perspective of the
569
- debugged program, and contains information about the place where the debugged
570
- program is stopped.</p><p>At any time you can call the <code>backtrace</code> command (or its alias <code>where</code>) to print
571
- the backtrace of the application. This can be very helpful to know how you got
572
- where you are. If you ever wondered about how you got somewhere in your code,
573
- then <code>backtrace</code> will supply the answer.</p><div class="code_container">
574
- <pre class="brush: plain; gutter: false; toolbar: false">
575
- (byebug) where
576
- --&gt; #0 ArticlesController.index
577
- at /PathTo/project/test_app/app/controllers/articles_controller.rb:8
578
- #1 ActionController::ImplicitRender.send_action(method#String, *args#Array)
579
- at /PathToGems/actionpack-4.2.0/lib/action_controller/metal/implicit_render.rb:4
580
- #2 AbstractController::Base.process_action(action#NilClass, *args#Array)
581
- at /PathToGems/actionpack-4.2.0/lib/abstract_controller/base.rb:189
582
- #3 ActionController::Rendering.process_action(action#NilClass, *args#NilClass)
583
- at /PathToGems/actionpack-4.2.0/lib/action_controller/metal/rendering.rb:10
584
- ...
585
-
586
- </pre>
587
- </div>
588
- <p>The current frame is marked with <code>--&gt;</code>. You can move anywhere you want in this
589
- trace (thus changing the context) by using the <code>frame _n_</code> command, where <em>n</em> is
590
- the specified frame number. If you do that, <code>byebug</code> will display your new
591
- context.</p><div class="code_container">
592
- <pre class="brush: plain; gutter: false; toolbar: false">
593
- (byebug) frame 2
594
-
595
- [184, 193] in /PathToGems/actionpack-4.2.0/lib/abstract_controller/base.rb
596
- 184: # is the intended way to override action dispatching.
597
- 185: #
598
- 186: # Notice that the first argument is the method to be dispatched
599
- 187: # which is *not* necessarily the same as the action name.
600
- 188: def process_action(method_name, *args)
601
- =&gt; 189: send_action(method_name, *args)
602
- 190: end
603
- 191:
604
- 192: # Actually call the method associated with the action. Override
605
- 193: # this method if you wish to change how action methods are called,
606
-
607
- (byebug)
608
-
609
- </pre>
610
- </div>
611
- <p>The available variables are the same as if you were running the code line by
612
- line. After all, that's what debugging is.</p><p>You can also use <code>up [n]</code> (<code>u</code> for abbreviated) and <code>down [n]</code> commands in order
613
- to change the context <em>n</em> frames up or down the stack respectively. <em>n</em> defaults
614
- to one. Up in this case is towards higher-numbered stack frames, and down is
615
- towards lower-numbered stack frames.</p><h4 id="threads">3.4 Threads</h4><p>The debugger can list, stop, resume and switch between running threads by using
616
- the <code>thread</code> command (or the abbreviated <code>th</code>). This command has a handful of
617
- options:</p>
618
- <ul>
619
- <li>
620
- <code>thread</code> shows the current thread.</li>
621
- <li>
622
- <code>thread list</code> is used to list all threads and their statuses. The plus +
623
- character and the number indicates the current thread of execution.</li>
624
- <li>
625
- <code>thread stop _n_</code> stop thread <em>n</em>.</li>
626
- <li>
627
- <code>thread resume _n_</code> resumes thread <em>n</em>.</li>
628
- <li>
629
- <code>thread switch _n_</code> switches the current thread context to <em>n</em>.</li>
630
- </ul>
631
- <p>This command is very helpful, among other occasions, when you are debugging
632
- concurrent threads and need to verify that there are no race conditions in your
633
- code.</p><h4 id="inspecting-variables">3.5 Inspecting Variables</h4><p>Any expression can be evaluated in the current context. To evaluate an
634
- expression, just type it!</p><p>This example shows how you can print the instance variables defined within the
635
- current context:</p><div class="code_container">
636
- <pre class="brush: plain; gutter: false; toolbar: false">
637
- [3, 12] in /PathTo/project/app/controllers/articles_controller.rb
638
- 3:
639
- 4: # GET /articles
640
- 5: # GET /articles.json
641
- 6: def index
642
- 7: byebug
643
- =&gt; 8: @articles = Article.find_recent
644
- 9:
645
- 10: respond_to do |format|
646
- 11: format.html # index.html.erb
647
- 12: format.json { render json: @articles }
648
-
649
- (byebug) instance_variables
650
- [:@_action_has_layout, :@_routes, :@_headers, :@_status, :@_request,
651
- :@_response, :@_env, :@_prefixes, :@_lookup_context, :@_action_name,
652
- :@_response_body, :@marked_for_same_origin_verification, :@_config]
653
-
654
- </pre>
655
- </div>
656
- <p>As you may have figured out, all of the variables that you can access from a
657
- controller are displayed. This list is dynamically updated as you execute code.
658
- For example, run the next line using <code>next</code> (you'll learn more about this
659
- command later in this guide).</p><div class="code_container">
660
- <pre class="brush: plain; gutter: false; toolbar: false">
661
- (byebug) next
662
- [5, 14] in /PathTo/project/app/controllers/articles_controller.rb
663
- 5 # GET /articles.json
664
- 6 def index
665
- 7 byebug
666
- 8 @articles = Article.find_recent
667
- 9
668
- =&gt; 10 respond_to do |format|
669
- 11 format.html # index.html.erb
670
- 12 format.json { render json: @articles }
671
- 13 end
672
- 14 end
673
- 15
674
- (byebug)
675
-
676
- </pre>
677
- </div>
678
- <p>And then ask again for the instance_variables:</p><div class="code_container">
679
- <pre class="brush: plain; gutter: false; toolbar: false">
680
- (byebug) instance_variables.include? "@articles"
681
- true
682
-
683
- </pre>
684
- </div>
685
- <p>Now <code>@articles</code> is included in the instance variables, because the line defining it
686
- was executed.</p><div class="info"><p>You can also step into <strong>irb</strong> mode with the command <code>irb</code> (of course!).
687
- This way an irb session will be started within the context you invoked it. But
688
- be warned: this is an experimental feature.</p></div><p>The <code>var</code> method is the most convenient way to show variables and their values.
689
- Let's let <code>byebug</code> to help us with it.</p><div class="code_container">
690
- <pre class="brush: plain; gutter: false; toolbar: false">
691
- (byebug) help var
692
- v[ar] cl[ass] show class variables of self
693
- v[ar] const &lt;object&gt; show constants of object
694
- v[ar] g[lobal] show global variables
695
- v[ar] i[nstance] &lt;object&gt; show instance variables of object
696
- v[ar] l[ocal] show local variables
697
-
698
- </pre>
699
- </div>
700
- <p>This is a great way to inspect the values of the current context variables. For
701
- example, to check that we have no local variables currently defined.</p><div class="code_container">
702
- <pre class="brush: plain; gutter: false; toolbar: false">
703
- (byebug) var local
704
- (byebug)
705
-
706
- </pre>
707
- </div>
708
- <p>You can also inspect for an object method this way:</p><div class="code_container">
709
- <pre class="brush: plain; gutter: false; toolbar: false">
710
- (byebug) var instance Article.new
711
- @_start_transaction_state = {}
712
- @aggregation_cache = {}
713
- @association_cache = {}
714
- @attributes = {"id"=&gt;nil, "created_at"=&gt;nil, "updated_at"=&gt;nil}
715
- @attributes_cache = {}
716
- @changed_attributes = nil
717
- ...
718
-
719
- </pre>
720
- </div>
721
- <div class="info"><p>The commands <code>p</code> (print) and <code>pp</code> (pretty print) can be used to evaluate
722
- Ruby expressions and display the value of variables to the console.</p></div><p>You can use also <code>display</code> to start watching variables. This is a good way of
723
- tracking the values of a variable while the execution goes on.</p><div class="code_container">
724
- <pre class="brush: plain; gutter: false; toolbar: false">
725
- (byebug) display @articles
726
- 1: @articles = nil
727
-
728
- </pre>
729
- </div>
730
- <p>The variables inside the displaying list will be printed with their values after
731
- you move in the stack. To stop displaying a variable use <code>undisplay _n_</code> where
732
- <em>n</em> is the variable number (1 in the last example).</p><h4 id="step-by-step">3.6 Step by Step</h4><p>Now you should know where you are in the running trace and be able to print the
733
- available variables. But lets continue and move on with the application
734
- execution.</p><p>Use <code>step</code> (abbreviated <code>s</code>) to continue running your program until the next
735
- logical stopping point and return control to the debugger.</p><p>You may also use <code>next</code> which is similar to step, but function or method calls
736
- that appear within the line of code are executed without stopping.</p><div class="info"><p>You can also use <code>step n</code> or <code>next n</code> to move forwards <code>n</code> steps at once.</p></div><p>The difference between <code>next</code> and <code>step</code> is that <code>step</code> stops at the next line
737
- of code executed, doing just a single step, while <code>next</code> moves to the next line
738
- without descending inside methods.</p><p>For example, consider the following situation:</p><div class="code_container">
739
- <pre class="brush: ruby; gutter: false; toolbar: false">
740
- Started GET "/" for 127.0.0.1 at 2014-04-11 13:39:23 +0200
741
- Processing by ArticlesController#index as HTML
742
-
743
- [1, 8] in /home/davidr/Proyectos/test_app/app/models/article.rb
744
- 1: class Article &lt; ActiveRecord::Base
745
- 2:
746
- 3: def self.find_recent(limit = 10)
747
- 4: byebug
748
- =&gt; 5: where('created_at &gt; ?', 1.week.ago).limit(limit)
749
- 6: end
750
- 7:
751
- 8: end
752
-
753
- (byebug)
754
-
755
- </pre>
756
- </div>
757
- <p>If we use <code>next</code>, we want go deep inside method calls. Instead, byebug will go
758
- to the next line within the same context. In this case, this is the last line of
759
- the method, so <code>byebug</code> will jump to next next line of the previous frame.</p><div class="code_container">
760
- <pre class="brush: plain; gutter: false; toolbar: false">
761
- (byebug) next
762
- Next went up a frame because previous frame finished
763
-
764
- [4, 13] in /PathTo/project/test_app/app/controllers/articles_controller.rb
765
- 4: # GET /articles
766
- 5: # GET /articles.json
767
- 6: def index
768
- 7: @articles = Article.find_recent
769
- 8:
770
- =&gt; 9: respond_to do |format|
771
- 10: format.html # index.html.erb
772
- 11: format.json { render json: @articles }
773
- 12: end
774
- 13: end
775
-
776
- (byebug)
777
-
778
- </pre>
779
- </div>
780
- <p>If we use <code>step</code> in the same situation, we will literally go the next ruby
781
- instruction to be executed. In this case, the activesupport's <code>week</code> method.</p><div class="code_container">
782
- <pre class="brush: plain; gutter: false; toolbar: false">
783
- (byebug) step
784
-
785
- [50, 59] in /PathToGems/activesupport-4.2.0/lib/active_support/core_ext/numeric/time.rb
786
- 50: ActiveSupport::Duration.new(self * 24.hours, [[:days, self]])
787
- 51: end
788
- 52: alias :day :days
789
- 53:
790
- 54: def weeks
791
- =&gt; 55: ActiveSupport::Duration.new(self * 7.days, [[:days, self * 7]])
792
- 56: end
793
- 57: alias :week :weeks
794
- 58:
795
- 59: def fortnights
796
-
797
- (byebug)
798
-
799
- </pre>
800
- </div>
801
- <p>This is one of the best ways to find bugs in your code, or perhaps in Ruby on
802
- Rails.</p><h4 id="breakpoints">3.7 Breakpoints</h4><p>A breakpoint makes your application stop whenever a certain point in the program
803
- is reached. The debugger shell is invoked in that line.</p><p>You can add breakpoints dynamically with the command <code>break</code> (or just <code>b</code>).
804
- There are 3 possible ways of adding breakpoints manually:</p>
805
- <ul>
806
- <li>
807
- <code>break line</code>: set breakpoint in the <em>line</em> in the current source file.</li>
808
- <li>
809
- <code>break file:line [if expression]</code>: set breakpoint in the <em>line</em> number inside
810
- the <em>file</em>. If an <em>expression</em> is given it must evaluated to <em>true</em> to fire up
811
- the debugger.</li>
812
- <li>
813
- <code>break class(.|\#)method [if expression]</code>: set breakpoint in <em>method</em> (. and
814
- # for class and instance method respectively) defined in <em>class</em>. The
815
- <em>expression</em> works the same way as with file:line.</li>
816
- </ul>
817
- <p>For example, in the previous situation</p><div class="code_container">
818
- <pre class="brush: plain; gutter: false; toolbar: false">
819
- [4, 13] in /PathTo/project/app/controllers/articles_controller.rb
820
- 4: # GET /articles
821
- 5: # GET /articles.json
822
- 6: def index
823
- 7: @articles = Article.find_recent
824
- 8:
825
- =&gt; 9: respond_to do |format|
826
- 10: format.html # index.html.erb
827
- 11: format.json { render json: @articles }
828
- 12: end
829
- 13: end
830
-
831
- (byebug) break 11
832
- Created breakpoint 1 at /PathTo/project/app/controllers/articles_controller.rb:11
833
-
834
-
835
- </pre>
836
- </div>
837
- <p>Use <code>info breakpoints _n_</code> or <code>info break _n_</code> to list breakpoints. If you
838
- supply a number, it lists that breakpoint. Otherwise it lists all breakpoints.</p><div class="code_container">
839
- <pre class="brush: plain; gutter: false; toolbar: false">
840
- (byebug) info breakpoints
841
- Num Enb What
842
- 1 y at /PathTo/project/app/controllers/articles_controller.rb:11
843
-
844
- </pre>
845
- </div>
846
- <p>To delete breakpoints: use the command <code>delete _n_</code> to remove the breakpoint
847
- number <em>n</em>. If no number is specified, it deletes all breakpoints that are
848
- currently active.</p><div class="code_container">
849
- <pre class="brush: plain; gutter: false; toolbar: false">
850
- (byebug) delete 1
851
- (byebug) info breakpoints
852
- No breakpoints.
853
-
854
- </pre>
855
- </div>
856
- <p>You can also enable or disable breakpoints:</p>
857
- <ul>
858
- <li>
859
- <code>enable breakpoints</code>: allow a <em>breakpoints</em> list or all of them if no list is
860
- specified, to stop your program. This is the default state when you create a
861
- breakpoint.</li>
862
- <li>
863
- <code>disable breakpoints</code>: the <em>breakpoints</em> will have no effect on your program.</li>
864
- </ul>
865
- <h4 id="catching-exceptions">3.8 Catching Exceptions</h4><p>The command <code>catch exception-name</code> (or just <code>cat exception-name</code>) can be used to
866
- intercept an exception of type <em>exception-name</em> when there would otherwise be no
867
- handler for it.</p><p>To list all active catchpoints use <code>catch</code>.</p><h4 id="resuming-execution">3.9 Resuming Execution</h4><p>There are two ways to resume execution of an application that is stopped in the
868
- debugger:</p>
869
- <ul>
870
- <li>
871
- <code>continue</code> [line-specification] (or <code>c</code>): resume program execution, at the
872
- address where your script last stopped; any breakpoints set at that address are
873
- bypassed. The optional argument line-specification allows you to specify a line
874
- number to set a one-time breakpoint which is deleted when that breakpoint is
875
- reached.</li>
876
- <li>
877
- <code>finish</code> [frame-number] (or <code>fin</code>): execute until the selected stack frame
878
- returns. If no frame number is given, the application will run until the
879
- currently selected frame returns. The currently selected frame starts out the
880
- most-recent frame or 0 if no frame positioning (e.g up, down or frame) has been
881
- performed. If a frame number is given it will run until the specified frame
882
- returns.</li>
883
- </ul>
884
- <h4 id="editing">3.10 Editing</h4><p>Two commands allow you to open code from the debugger into an editor:</p>
885
- <ul>
886
- <li>
887
- <code>edit [file:line]</code>: edit <em>file</em> using the editor specified by the EDITOR
888
- environment variable. A specific <em>line</em> can also be given.</li>
889
- </ul>
890
- <h4 id="quitting">3.11 Quitting</h4><p>To exit the debugger, use the <code>quit</code> command (abbreviated <code>q</code>), or its alias
891
- <code>exit</code>.</p><p>A simple quit tries to terminate all threads in effect. Therefore your server
892
- will be stopped and you will have to start it again.</p><h4 id="settings">3.12 Settings</h4><p><code>byebug</code> has a few available options to tweak its behaviour:</p>
893
- <ul>
894
- <li>
895
- <code>set autoreload</code>: Reload source code when changed (default: true).</li>
896
- <li>
897
- <code>set autolist</code>: Execute <code>list</code> command on every breakpoint (default: true).</li>
898
- <li>
899
- <code>set listsize _n_</code>: Set number of source lines to list by default to <em>n</em>
900
- (default: 10)</li>
901
- <li>
902
- <code>set forcestep</code>: Make sure the <code>next</code> and <code>step</code> commands always move to a new
903
- line.</li>
904
- </ul>
905
- <p>You can see the full list by using <code>help set</code>. Use <code>help set _subcommand_</code> to
906
- learn about a particular <code>set</code> command.</p><div class="info"><p>You can save these settings in an <code>.byebugrc</code> file in your home directory.
907
- The debugger reads these global settings when it starts. For example:</p></div><div class="code_container">
908
- <pre class="brush: plain; gutter: false; toolbar: false">
909
- set forcestep
910
- set listsize 25
911
-
912
- </pre>
913
- </div>
914
- <h3 id="debugging-memory-leaks">4 Debugging Memory Leaks</h3><p>A Ruby application (on Rails or not), can leak memory - either in the Ruby code
915
- or at the C code level.</p><p>In this section, you will learn how to find and fix such leaks by using tool
916
- such as Valgrind.</p><h4 id="valgrind">4.1 Valgrind</h4><p><a href="http://valgrind.org/">Valgrind</a> is a Linux-only application for detecting
917
- C-based memory leaks and race conditions.</p><p>There are Valgrind tools that can automatically detect many memory management
918
- and threading bugs, and profile your programs in detail. For example, if a C
919
- extension in the interpreter calls <code>malloc()</code> but doesn't properly call
920
- <code>free()</code>, this memory won't be available until the app terminates.</p><p>For further information on how to install Valgrind and use with Ruby, refer to
921
- <a href="http://blog.evanweaver.com/articles/2008/02/05/valgrind-and-ruby/">Valgrind and Ruby</a>
922
- by Evan Weaver.</p><h3 id="plugins-for-debugging">5 Plugins for Debugging</h3><p>There are some Rails plugins to help you to find errors and debug your
923
- application. Here is a list of useful plugins for debugging:</p>
924
- <ul>
925
- <li>
926
- <a href="https://github.com/josevalim/rails-footnotes">Footnotes</a> Every Rails page has
927
- footnotes that give request information and link back to your source via
928
- TextMate.</li>
929
- <li>
930
- <a href="https://github.com/ntalbott/query_trace/tree/master">Query Trace</a> Adds query
931
- origin tracing to your logs.</li>
932
- <li>
933
- <a href="https://github.com/nesquena/query_reviewer">Query Reviewer</a> This rails plugin
934
- not only runs "EXPLAIN" before each of your select queries in development, but
935
- provides a small DIV in the rendered output of each page with the summary of
936
- warnings for each query that it analyzed.</li>
937
- <li>
938
- <a href="https://github.com/smartinez87/exception_notification/tree/master">Exception Notifier</a>
939
- Provides a mailer object and a default set of templates for sending email
940
- notifications when errors occur in a Rails application.</li>
941
- <li>
942
- <a href="https://github.com/charliesome/better_errors">Better Errors</a> Replaces the
943
- standard Rails error page with a new one containing more contextual information,
944
- like source code and variable inspection.</li>
945
- <li>
946
- <a href="https://github.com/dejan/rails_panel">RailsPanel</a> Chrome extension for Rails
947
- development that will end your tailing of development.log. Have all information
948
- about your Rails app requests in the browser - in the Developer Tools panel.
949
- Provides insight to db/rendering/total times, parameter list, rendered views and
950
- more.</li>
951
- </ul>
952
- <h3 id="references">6 References</h3>
953
- <ul>
954
- <li><a href="http://bashdb.sourceforge.net/ruby-debug/home-page.html">ruby-debug Homepage</a></li>
955
- <li><a href="https://github.com/cldwalker/debugger">debugger Homepage</a></li>
956
- <li><a href="https://github.com/deivid-rodriguez/byebug">byebug Homepage</a></li>
957
- <li><a href="http://www.sitepoint.com/debug-rails-app-ruby-debug/">Article: Debugging a Rails application with ruby-debug</a></li>
958
- <li><a href="http://railscasts.com/episodes/54-debugging-ruby-revised">Ryan Bates' debugging ruby (revised) screencast</a></li>
959
- <li><a href="http://railscasts.com/episodes/24-the-stack-trace">Ryan Bates' stack trace screencast</a></li>
960
- <li><a href="http://railscasts.com/episodes/56-the-logger">Ryan Bates' logger screencast</a></li>
961
- <li><a href="http://bashdb.sourceforge.net/ruby-debug.html">Debugging with ruby-debug</a></li>
962
- </ul>
963
-
964
-
965
- <h3>Feedback</h3>
966
- <p>
967
- You're encouraged to help improve the quality of this guide.
968
- </p>
969
- <p>
970
- Please contribute if you see any typos or factual errors.
971
- 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.
972
- </p>
973
- <p>
974
- You may also find incomplete content, or stuff that is not up to date.
975
- Please do add any missing documentation for master. Make sure to check
976
- <a href="http://edgeguides.rubyonrails.org">Edge Guides</a> first to verify
977
- if the issues are already fixed or not on the master branch.
978
- Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
979
- for style and conventions.
980
- </p>
981
- <p>
982
- If for whatever reason you spot something to fix but cannot patch it yourself, please
983
- <a href="https://github.com/rails/rails/issues">open an issue</a>.
984
- </p>
985
- <p>And last but not least, any kind of discussion regarding Ruby on Rails
986
- documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
987
- </p>
988
- </div>
989
- </div>
990
- </div>
991
-
992
- <hr class="hide" />
993
- <div id="footer">
994
- <div class="wrapper">
995
- <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>
996
- <p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
997
-
998
- </div>
999
- </div>
1000
-
1001
- <script type="text/javascript" src="javascripts/jquery.min.js"></script>
1002
- <script type="text/javascript" src="javascripts/responsive-tables.js"></script>
1003
- <script type="text/javascript" src="javascripts/guides.js"></script>
1004
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
1005
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
1006
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
1007
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
1008
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
1009
- <script type="text/javascript">
1010
- SyntaxHighlighter.all();
1011
- $(guidesIndex.bind);
1012
- </script>
1013
- </body>
1014
- </html>