I have a small rails app, which was running fine with Ruby 1.8x and Rails 2.x. In a regrettable decision, I decided to move to Ruby 1.9.x and Rails 3, and it's a glorious pain.
My Ruby app uses MySQL, and I use Active Record for that. However there is an earlier pgm I had written to fill in the database before I did Rails (2.x), which is part of the complete application now. (I can test/run the standalone pgm outside Rails and there is no problem.)
This standalone program is using MySQL and dbi gems. I call this program as such from a model:
system("ruby standalonepgm.rb -args ")
In Rails 2.0 this works without any issues. In 3.0 the program exits without any way to capture the error.
Running under console I see that the program dies because it can't find the dbi gem!
If I put the dbi gem in the Gemfile and do bundle date, then there is real trouble. Rails refuses to start - the rails server dies with all kind of issues. I can put in the screendump, but I think that's unimportant.
There seem to be 2 issues:
- DBI is surely incompatible with the gods of Rails
- Rails creates a sandbox, and all programs called must live in that sandbox (that's why just a require statement doesn't suffice .. it has to be in Gemfile).
Is it fixable or I am one of those who got bitten by the hidden black magic of rails, and my past 8+ weeks of effort is down the tubes?