aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/debugging_rails_applications.textile
diff options
context:
space:
mode:
authorJeffrey Hardy <packagethief@gmail.com>2009-03-23 23:15:47 -0400
committerJeffrey Hardy <packagethief@gmail.com>2009-03-23 23:15:47 -0400
commit76556b08bb8d22dccd7c44e302f625442c5cc8f0 (patch)
tree560889c89fcaac57778b6cfe2ba135fd70a69f5c /railties/guides/source/debugging_rails_applications.textile
parent4b6458bf4cbf14007878b84a3fbc193f3365eebe (diff)
parentf7bdfe8bb76f7830cc2946cf0fcda2bb6d5e3e78 (diff)
downloadrails-76556b08bb8d22dccd7c44e302f625442c5cc8f0.tar.gz
rails-76556b08bb8d22dccd7c44e302f625442c5cc8f0.tar.bz2
rails-76556b08bb8d22dccd7c44e302f625442c5cc8f0.zip
Merge branch 'master' of git://github.com/lifo/docrails
* 'master' of git://github.com/lifo/docrails: (259 commits) Fix a small typo ensure authors get warnings about broken links, and ensure end users don't in guides generator, warn about duplicate header IDs only if WARN_DUPLICATE_HEADERS replace edit distance implementation with one written from scratch to avoid license issues removes a wrong comment in the finders guide updates fxn picture thanks but release notes are mostly frozen once they are published, and provide only an overview of the new stuff Added extra notes to nested model forms explanation in 2.3 release notes to cover has_one relationships clarifies a bit more what's the issue with check boxes and arrays of parameters be even more ambiguous about the order of generation of hidden input for check boxes in form helper guide this page referred to an :href_options keyword hash, in fact the correct keyword (the one the code responds to) is :html update explanation of check box generation according to f400209 Hidden field with check box goes first. update rack fixture to be ruby 1.9 compat Better error message to try to figure out why the CI build is failing ruby 1.9 compat: Pathname doesn't support =~ update rack fixture to be ruby 1.9 compat update metal fixtures to be ruby 1.9 compat Fix brittle Time.now mock Ensure our bundled version of rack is at the front of the load path ...
Diffstat (limited to 'railties/guides/source/debugging_rails_applications.textile')
-rw-r--r--railties/guides/source/debugging_rails_applications.textile12
1 files changed, 6 insertions, 6 deletions
diff --git a/railties/guides/source/debugging_rails_applications.textile b/railties/guides/source/debugging_rails_applications.textile
index b1d6db2e55..c059fdabf8 100644
--- a/railties/guides/source/debugging_rails_applications.textile
+++ b/railties/guides/source/debugging_rails_applications.textile
@@ -17,7 +17,7 @@ One common task is to inspect the contents of a variable. In Rails, you can do t
* +to_yaml+
* +inspect+
-h4. debug
+h4. +debug+
The +debug+ 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:
@@ -46,7 +46,7 @@ attributes_cache: {}
Title: Rails debugging guide
</yaml>
-h4. to_yaml
+h4. +to_yaml+
Displaying an instance variable, or any other object or method, in yaml format can be achieved this way:
@@ -76,7 +76,7 @@ attributes_cache: {}
Title: Rails debugging guide
</yaml>
-h4. inspect
+h4. +inspect+
Another useful method for displaying object values is +inspect+, especially when working with arrays or hashes. This will print the object value as a string. For example:
@@ -96,7 +96,7 @@ Will be rendered as follows:
Title: Rails debugging guide
</pre>
-h4. Debugging Javascript
+h4. Debugging JavaScript
Rails has built-in support to debug RJS, to active it, set +ActionView::Base.debug_rjs+ to _true_, this will specify whether RJS responses should be wrapped in a try/catch block that alert()s the caught exception (and then re-raises it).
@@ -118,7 +118,7 @@ h3. The Logger
It can also be useful to save information to log files at runtime. Rails maintains a separate log file for each runtime environment.
-h4. What is The Logger?
+h4. What is the Logger?
Rails makes use of Ruby's standard +logger+ to write log information. You can also substitute another logger such as +Log4R+ if you wish.
@@ -209,7 +209,7 @@ Completed in 0.01224 (81 reqs/sec) | DB: 0.00044 (3%) | 302 Found [http://localh
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.
-h3. Debugging with ruby-debug
+h3. Debugging with +ruby-debug+
When your code is behaving in unexpected ways, you can try printing to logs or the console to diagnose the problem. Unfortunately, there are times when this sort of error tracking is not effective in finding the root cause of a problem. When you actually need to journey into your running source code, the debugger is your best companion.