Break Point not working in Ruby 1.8.5?

Bharat R. wrote:

I am glad that you brought up logs. Do you know an effective way of
viewing “formatted” log in Windows environment? In linux, the less
command does a great job of showing formatted entries. I have not been
able to replicate it in the Windows environment. I do not want to use
Cygwin since I have a dual boot machine and I can boot into Linux if I
want to.

Well, it’s no substitute for a good command-line shell, but RadRails has
a “tail” function for log files. Just right-click on the log file in the
file navigator and choose “Tail”. Also, if you run mongrel (or webrick)
from within RadRails, it puts the mongrel output to a console. So,
stdout (puts) goes to the mongrel output and rails logging (logger) goes
to the console tailing the development.log.

b

Thanks Jon and Ben.
Jon, I use vim in linux and GVIM and CREAM in Windows environment. Do
you know an easy way of turning formatting on in these editors? I am
not very familiar with them in Windows. In Linux “less” works great for
me so I don’t bother. Here is how it looks like in my GVIM or CREAM
environment in Windows:

e[4;36;1mSQL (0.078000)e[0m e[0;1mSET SQL_AUTO_IS_NULL=0e[0m
e[4;35;1mSQL (0.094000)e[0m e[0mCREATE TABLE schema_info (version
int(11))e[0m
e[4;36;1mSQL (0.031000)e[0m e[0;1mINSERT INTO schema_info (version)
VALUES(0)e[0m
e[4;35;1mSQL (0.000000)e[0m e[0mMysql::Error: #42S01Table
‘schema_info’ already exists: CREATE TABLE schema_info (version
int(11))e[0m
e[4;36;1mSQL (0.031000)e[0m e[0;1mSELECT version FROM
schema_infoe[0m
Migrating to CreateStories (1)
e[4;35;1mSQL (0.000000)e[0m e[0mMysql::Error: #42S02Unknown table
‘stories’: DROP TABLE storiese[0m
e[4;36;1mSQL (0.110000)e[0m e[0;1mCREATE TABLE stories (id int(11)
DEFAULT NULL auto_increment PRIMARY KEY, name varchar(255) DEFAULT
NULL, link varchar(255) DEFAULT NULL) ENGINE=InnoDBe[0m

Appreciate the help.
Bharat

Sorry, apparently I’ve missed this thread. The installation procedure
of ruby-debug on Windows should be the same as on any other platform.
The only difference is that you have to select mswin32 version of
ruby-debug-base:

C:>gem in ruby-debug
Bulk updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i386-mswin32)

  1. ruby-debug 0.8.1 (ruby)
  2. ruby-debug 0.8 (ruby)
  3. ruby-debug 0.7.5 (mswin32)
  4. ruby-debug 0.7.5 (ruby)
  5. Skip this gem
  6. Cancel installation

1
Install required dependency ruby-debug-base? [Yn] y
Select which gem to install for your platform (i386-mswin32)

  1. ruby-debug-base 0.8.1 (mswin32)
  2. ruby-debug-base 0.8.1 (ruby)
  3. Skip this gem
  4. Cancel installation

1
Successfully installed ruby-debug-0.8.1
Successfully installed ruby-debug-base-0.8.1-mswin32
Installing ri documentation for ruby-debug-0.8.1…
Installing ri documentation for ruby-debug-base-0.8.1-mswin32…
Installing RDoc documentation for ruby-debug-0.8.1…
Installing RDoc documentation for ruby-debug-base-0.8.1-mswin32…

The easiest way of debugging your Rails application is to run it with
rdebug script:

C:\rails-app>rdebug ./script/server

It should work with webrick or mongrel. If you use rdebug script you
don’t have to require ruby-debug in your environment.rb file and to
start the debugger with Debugger.start method. Of course, you still
have to set your breakpoints either explicitly using debugger’s
‘break’ command or via Kernel#debugger method.

Kent.

On 3/25/07, JESii [email protected] wrote:

Any thoughts as to what I’m doing wrong?

debugger

and you’ll have a breakpoint. I’d be curious to understand why this is
necessary.


Kent

Bharat… There is a ruby/rails plugin for vim that does it for me, as I
recall. I tried getting to the vim.org site, and it seems to be having
problems. The plugin that I use is by Tim Pope, and you can reach him at
“tim - AT - pope.info” He was very helpful when I was setting it up.
It’s
a VERY extensive plugin, and worked right out of the box for me.

Here’s a dump of my log; it doesn’t show the coloring and highlighting
that
my gvim gives me, so it’s much nicer than it looks here. (E.g., the
“DEPRECATION WARNING” is highlighted in red…)

Cheers…jon

Processing AssetController#index (for 10.0.0.152 at 2007-03-25 12:18:26)
[GET]
Session ID: 4cfdd7473a144e83709d3cd9463289f3
Parameters: {“action”=>“index”, “controller”=>“asset”}
Redirected to http://edp18:3010/asset/list
Completed in 0.00010 (10000 reqs/sec) | DB: 0.00000 (0%) | 302 Found
[http://edp18/asset]
DEPRECATION WARNING: model is deprecated and will be removed from Rails
2.0
See Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. for details. (called from
C:/Dev/INSTAN~1/rails_apps/AssetList/config/…/app/controllers/application.r
b:11)
DEPRECATION WARNING: depend_on is deprecated and will be removed from
Rails
2.0 See Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. for details. (called
from
model_without_deprecation at
C:/Dev/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.2/lib/action_con
troller/deprecated_dependencies.rb:13)
User Columns (0.015000) SHOW FIELDS FROM users

Processing AssetController#list (for 10.0.0.152 at 2007-03-25 12:18:27)
[GET]
Session ID: 4cfdd7473a144e83709d3cd9463289f3
Parameters: {“action”=>“list”, “controller”=>“asset”}
Asset Columns (0.000000) SHOW FIELDS FROM assets
Rendering layoutfalsetemplateajax_scaffold/list.rhtml within
layouts/asset
Rendering ajax_scaffold/list.rhtml
Start rendering component ({:action=>“table”,
:params=>{“action”=>“list”,
“controller”=>“asset”}, :controller=>“/asset”}):

Thanks, Kent… using redbug as you suggested did the trick.

I am curious as to why the other approach didn’t work… any thoughts on
that?

Cheers…jon