diff options
author | Ryan Bigg <radarlistener@gmail.com> | 2009-04-04 16:13:18 +1000 |
---|---|---|
committer | Ryan Bigg <radarlistener@gmail.com> | 2009-04-04 16:13:18 +1000 |
commit | e878c3e44a8dba19c1188b636e25ec1bc2165116 (patch) | |
tree | 3d06b83492653b6b73422cbf37014fc5c89e9685 /railties/guides/source/debugging_rails_applications.textile | |
parent | ab55ddcc4c5cf31bcaf7720b52dc55d6d54cb150 (diff) | |
parent | 9e9469e83f6144310115124cdecc5cb65db5128e (diff) | |
download | rails-e878c3e44a8dba19c1188b636e25ec1bc2165116.tar.gz rails-e878c3e44a8dba19c1188b636e25ec1bc2165116.tar.bz2 rails-e878c3e44a8dba19c1188b636e25ec1bc2165116.zip |
Merge branch 'master' of git@github.com:lifo/docrails
* 'master' of git@github.com:lifo/docrails: (319 commits)
deletes screencast promo in prologue, its proper place is the References section
Typo fix
list -> index
in caching guide, RESTifies some examples, revised conventions here and there
Tech edit of caching guide from Gregg Pollack
Fix typo in comment: hide_actions -> hide_action
Fix two typos in a comment in config/initializers/backtrace_silencers.rb
With -> with in a title
Clear up a little confusing wording in Routing Guide.
copyedited minor details in the rack on rails guide
remove piece of UrlWriter documentation claiming that you can access named routes as its class methods
Add note about change to session options
TRUNCATE is also a MySQL DDL statement, so document this is a possible caveat when using transactions and savepoints.
Improve documentation for ActiveResource::Validations, fix typos
Fix typos in ActiveResource::Base documentation, use present tense, reword confusing sentences
Update ActiveResource::Connection documentation to use present tense
Fix typos in Active Resource README
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
...
Diffstat (limited to 'railties/guides/source/debugging_rails_applications.textile')
-rw-r--r-- | railties/guides/source/debugging_rails_applications.textile | 12 |
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 <pre>-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. |