Debugging Rails 3 in (Aptana 3.4.2, Windows 7)

programming, rails

More Rails stuff.

I was using command line & vim to do some Rails stuff until fingers got tired of switching between files.

So I did a some searches and came up with a short list of IDEs for Rails and tried installing Aptana (currently 3.4.2).

As expected, problems came up despite having:

  1. Installed git, (on top of ruby/rails/gem)
  2. Made sure all these are accessible from the Command Prompt
  3. Installed ruby-debug-base 0.10.4 gem
  4. Installed ruby-debug-ide 0.4.22 gem

The error in the Console was:

Fast Debugger (ruby-debug-ide 0.4.22, ruby-debug-base 0.10.4) listens on 127.0.0.1:49946
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
9632: Exception in DebugThread loop: wrong number of arguments (0 for 1)
Backtrace:
c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide/ide_processor.rb:84:in `read_command'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide/ide_processor.rb:84:in `process_commands'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:122:in `start_control'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:103:in `initialize'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:103:in `new'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:103:in `start_control'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:65:in `start_server'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:69:in Exiting
`prepare_debugger'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:83:in `debug_program'
from: c:/dev/tools/ruby187/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.22/bin/rdebug-ide:110
from: c:/dev/tools/ruby187/bin/rdebug-ide:23:in `load'
from: c:/dev/tools/ruby187/bin/rdebug-ide:23

The main problem is: 9632: Exception in DebugThread loop: wrong number of arguments (0 for 1)

Did some search and turned out I HAD to remove the ruby-debug gem from my app’s Gemfile:

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem ‘ruby-debug’
# gem ‘ruby-debug19’

After commenting out that line above, reran bundle-install on the app, the debugger was working fine.

Rails w/ MySQL (Windows 7-64)

mysql, programming, rails

Mainly notes on setting up the following (suitable for Dreamhost’s Rails setup):

  • Ruby 1.8.7-p374
  • Rails 3.0.3
  • Ruby devkit  (from http://rubyinstaller.org/downloads/)
  • MySQL Installer 5.6.17 Community Server 64-bit
  • mysql2 GEM ‘0.2.22’

Install Ruby 1.8.7 by going to: http://rubyinstaller.org/downloads/

Install Rails 3.0.3 by: gem install rails -v 3.0.3

Latest MySQL: http://dev.mysql.com/downloads/mysql/

mysql2 GEM:

  1. Get mysql-connector-c-6.1.3-win32.zip from http://dev.mysql.com/downloads/connector/c/. Unzip to C:devtools (or wherever).
  2. Run: gem install mysql2 -v '0.2.22' -- --with-mysql-dir="c:devtoolsmysql-connector-c-6.1.3-win32"  (Use whatever path you unzipped the connector above.)

Go to the Rails app and modify the GemFile:

...
gem 'mysql2', '0.2.22'
...

Run: bundle install

Copy c:devtoolsmysql-connector-c-6.1.3-win32liblibmysql.dll to %RUBY_HOME%bin