3. Use The Logger
logger.debug "Person attributes hash: #{@person.attributes.inspect}“
logger.info "Processing the request...“
logger.fatal "Terminating application, raised unrecoverable error!!!"
Log levels: (debug|info|warn|error|fatal)
4. Use Rails Debugger
1. install
group :development do
gem 'debugger'
end
2. Call ‘debugger’ action inside ruby code to add break point
3. Run ‘rails s --debugger’
5. List Command
1. Use list or l (shorthand)
2. ‘l=‘ to see the current breakpoint with 5 previous
and 5 next code lines
3. ‘l’ to see the next 10 code lines
4. ‘l-’ to see the previous 10 code lines
6. More Commands
***Use ‘help’!***
1. ‘instance_variables’ – return array of all the instance variables
2. ‘next’ – execute the current line
3. ‘c’ (continue) – resume the execution
4. ‘where’ - see the stacktrace