The need for an IDE in Ruby + Rails

Reading the 4th edition of the Agile Web Development with Rails book by Sam Ruby.

With Ruby, however, much of this support just isn’t necessary. Editors such as TextMate and BBEdit give you 90 percent of what you’d get from an IDE but are far lighter weight. Just about the only useful IDE facility that’s missing is refactoring support.

Hm, that’s unfortunate. One of the most useful IDE facility that’s missing is debugging support !! When you have a debugger integrated into the editor, you are not anymore thinking about debugging because it’s just another editing task.

You look at a piece of code, put a breakpoint, hit debug, and review the application state at that point in time, step by step.

RubyMine Issues

RubyMine is my preferred IDE for Ruby development. I chose it for local and remote debugging from the browser. It has some space for improvement but it’s also pretty good. And support is excellent.

These are the issues that I’ve reported. This list is mostly for my own use.

  1. Replace in Path should be integrated into Find in Path
  2. The ‘Replace in Path’ functionality is completely broken
  3. Number of ‘Found usages’ depends on wether the button ‘Merge usages from the same line’ is pressed or not
  4. Exclude external libraries from a custom scope of ‘Find in Path’
  5. In a big text file, it takes up to 2 seconds to move the caret only 1 char
  6. Depending on path tooltip position, displayed document is garbled
  7. Depending on caret position, displayed document is garbled
  8. Replace in Path (with a grouping RegEx) makes a mess (depending on input)
  9. File comparison should behave differently for ending lines
  10. Breakpoints dialog floats on top even if the parent project is closed (it has no closing button either)
  11. Extract CSS is broken
  12. Dream remote debugging with the PassengerDebugger option
  13. How to remotely debug Rails in Apache + Passenger + RubyMine

Fixing “uninitialized constant MysqlCompat::MysqlRes”

This is an old problem that affects an old Ruby gem: mysql (2.8.1). Apparently, it has a little bug somewhere that makes it look for a file in the wrong folder. I get this error always after installing a new app. The last time has been some minutes ago, after installing TracksApp 2.1, which is based on the old Rails 2.3.

The MySQL page about Ruby adapters speaks about two of them. One called MySQL/Ruby, and the other (after a huge name creation effort)… Ruby/MySQL. They are respectively provided by the gems mysql (2.8.1) and ruby-mysql (2.9.10). As you may have noticed, the first gem is the old version of the second. That is also confirmed by the dates they got updated, which is: 2.8.1, on 2009-08-21 and 2.9.10, on 2012-07-12.

Both adapters are authored by Tomita Masahiro. I do appreciate the effort he did, and his generosity in making them available to me, no doubt about that. But in my opinion, the name change was a mistake. I suppose he did it to tell the world they were two very different adapters (the old one C-based and the new one Ruby-based). Nonetheless, they really were two subsequent versions of the same thing.

The problem with TracksApp is exactly that. If Tomita Masahiro had stuck to the mysql name, then gem “mysql” in TracksApps would have referenced the latest version (what today is instead ruby-mysql) and all would have worked fine. But now, even with ruby-mysql installed, that gem requirement in TracksApp makes my system install the old mysql gem. That in turn makes Rails prefer mysql over ruby-mysql (why? lexical order?) and due to the known bug all my apps break.

My solution is to manually uninstall mysql each time it gets installed by some app. In fact I don’t know how to make my global Rails environment ignore mysql (2.8.1) even if some app requires it. I’ve tried with “bundle install –without mysql”, but mysql is a gem, not a group, so it does not work… My fix works because ruby-mysql perfectly replaces mysql and it’s just a drop-in, sharing the same adapter name (mysql).

Clearly, TracksApp is a new version of an old software, even if it is still based on Rails 2.3. If I was developing it, I’d have updated the Gemfile…