"We're sorry, but something went wrong." is the message I got when I
started up an RoR app in the environment:
Rails 2.3.5
Ruby 1.8.6
WinXP-Pro/SP3
Firefox 3.6
MySQL 5.0.37-community-nt
Mongrel
The app under development was working fine until I (stupidly) thought
I needed to upgrade MySQL to 5.1.44.
I took the precaution of MySQL-dumping
the development db before upgrading. Then I ran into problems which
led me to switch back to a clean install of 5.0.37 and reboot.
I used MySQL to reinstall the development db and tested it
successfully under the MySQL client.
I started up Mongrel and ran my app using localhost:3000, getting the
captioned message.
The development log is presented below. Suggestions are extremely
welcome.
Thanks for your ideas. It's great to have friends around the world.
After I posted the message, I went on a bug hunt that, after two
hours, revealed that the message should have been supplemented with:
Database "RTS_Development" does not exist". Then I would have known
that my restoration of the development database was mis-named. The I
would have exported the bad and renamed my import.
But alas, I had to find this out for myself. There was no way I
could have posted all the details of my misadventure to y'all so that
you'd have a chance at spotting my error.
So, again, thanks. I'm OK for now, but another problem will crop up
soon, no doubt.
I've got the entire application back to where I was before I thought
upgrading MySQL might be the solution to my problem.
The problem was that I added an expense item which included an amount,
say 10.50. After saving the new item, the expense amount displayed
as simply 10 -- no .50 anywhere. I finally realized my problem was
scale=0 for my amount column.
I generated/edited this migration to fix my problem. Do you think it
will work if I use rake to apply it?
class ChangeExpenseTblAmountCol < ActiveRecord::Migration
def self.up
class Expense
change_column :amount, decimal :precision=>10, scale=>2
end
end
def self.down
end
end
Or should I have simply changed the class name (which is simply the
name I gave to the generator).
I'm running Rails 2.3.5, Ruby 1.8.6 and MySQL 5.0.37-community-nt
There are a few ways to get out of this problem, most of them driving
you to a MySQL DLL downgrade.
IMHO, the fact is MySQL 5.1 doesn't work properly with RoR, so, stick
with 5.0, report the problem to MySQL staff and wait for: an official
patch for 5.1, or for the 5.2 hoping it will solve the problem.