instead of just following the book you need to think about the
“conceptual” steps that are being taken. Often, the names of the
functions will help you.
In this case, you have two pretty clear choices: you work with the mysql
gem, which is 5+ years old but which is used in the book, or you try to
find out how to do what you want with the newer gem.
It’s not very complicated what you want to do because all you want to do
at the moment is
- connect to the database
- submit queries
You can test this process by using the database from the command line
(although often the connection process is done automatically from the
command line as it may be part of configuring the “database”.)
If you look at the first example on the github page for mysql2 it gives
you some idea about how to do it, but google will always help you find
more examples and answers to problems.
If you can’t get mysql or mariadb to work, try using sqlite. You may
find it generally more easier to use ruby with a unix operating system
but I can’t really comment on this because I don’t use windows.