Hassan Schroeder wrote in post #964802:
A bit more of the code - to clarify the origin...
:database => 'db/development.mysql2')
The line above is *wrong* -- look at your config/database.yml entries
and compare. That is simply not a valid MySQL entry.
Hassan Schroeder ------------------------ firstname.lastname@example.org
The relevance was to show the full title and version number of the book
from which this example code is taken, especially since I know many
others are also reading and following that book and are having similar
problems. Since many consider it the definitive work on Ruby on Rails
then I think it's worth mentioning it. I agree the actual additional
code shown beyond the comments in the header adds nothing to the problem
I know that line is wrong - Rails tells me that - what I don't know is
how to fix it, or even why the store.rb file exists at all in the app
However I downloaded this code from the web site associated with the
book and that's why it's in there. The original code from the book uses
sqlite but I prefer mysql and so changed it to use mysql.
Following the book, and creating my own project, I don't encounter this
problem. But I do encounter a serious problem on "test functionals"
where the db tables are created, seeded, and then promptly dropped prior
to the first test running so all the tests fail. The applicaiton itself
So as one particular way of investigating this I decided to download the
code from the book, reconfigure it for mysql, and see if the testing
problem still exists. However I can't get beyond the db:migrate because
of this problem being explored here.
Unfortunately, although I've spent many hours on RoR on both Windows 7
and Ubuntu, the Rails aspects of it are IMHO poorly documented. Ruby
language - yes good documentaiton and I understand that with no problem.
But Rails is unusual in that you can place pieces of an Object in many
places and they all come together at runtime, but if that fails to
integrate properly then you're pretty much reliant on helpful guys like
yourself online pointing you in the right direction.
I am working my way through...
(a) Agile Web Development with Rails Ed.4
(b) Rails Recipes
(c) RailsSpace: Building a Social Networking Website with Ruby on Rails
(d) Beginning Ruby on Rails E-Commerce
building all of the examples. But in each case I'm encountering problems
So if I can solve why "test functionals" keeps dropping the tables
before running the tests then that would be the biggest help.
I realise that test mode is supposed to start with an empty database so
that the tests always run the same. It then creates the tables, then it
seeds them, then for some reason it drops the tables and runs the first
test which failes because the tables don't exist.
I may be wrong here but I think it used to work before the seeds were
written. That it was after the book covered seeds and the seeds file was
created that this testing problem occured.
It might also have something to do with using mysql with myisam files
because the transaction capability is different according to the Rails
books (although I've not noticed that in the past).