Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7797

Show
Ignore:
Timestamp:
10/08/07 05:36:04 (1 year ago)
Author:
nzkoz
Message:

Improve README documentation. Closes #8770 [mikel]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1-2-stable/railties/README

    r4991 r7797  
    6565== Debugging Rails 
    6666 
    67 Have "tail -f" commands running on the server.log and development.log. Rails will 
    68 automatically display debugging and runtime information to these files. Debugging 
    69 info will also be shown in the browser on requests from 127.0.0.1. 
     67Sometimes your application goes wrong.  Fortunately there are a lot of tools that 
     68will help you debug it and get it back on the rails. 
     69 
     70First area to check is the application log files.  Have "tail -f" commands running 
     71on the server.log and development.log. Rails will automatically display debugging 
     72and runtime information to these files. Debugging info will also be shown in the 
     73browser on requests from 127.0.0.1. 
     74 
     75You can also log your own messages directly into the log file from your code using 
     76the Ruby logger class from inside your controllers. Example: 
     77 
     78  class WeblogController < ActionController::Base 
     79    def destroy 
     80      @weblog = Weblog.find(params[:id]) 
     81      @weblog.destroy 
     82      logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") 
     83    end 
     84  end 
     85 
     86The result will be a message in your log file along the lines of: 
     87 
     88  Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1 
     89 
     90More information on how to use the logger is at http://www.ruby-doc.org/core/ 
     91 
     92Also, Ruby documentation can be found at http://www.ruby-lang.org/ including: 
     93 
     94* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/ 
     95* Learn to Program: http://pine.fm/LearnToProgram/  (a beginners guide) 
     96 
     97These two online (and free) books will bring you up to speed on the Ruby language 
     98and also on programming in general. 
    7099 
    71100