I am new to Ruby and RubyOnRails, and am trying to learn textbooks.
The specific book that I am referring to at this point in time is
"Beginning Ruby on Rails E-Commerce" published by Apress and written by
Christian Hellsten and Jarkko Laine.
The book uses Ubuntu Linux. I am also using Ubuntu 6.06 Dapper. I
have installed MySQL, ruby, gems, rubyonrails as instructed in the book
and everything has installed correctly (or so it seems to me).
I am upto chapter 2 where the authors show you how to create a simple
authors table with first_name and last_name fields using migrations.
Here is the migration script contained in a file called
001_create_authors.rb stored in the ~/projects/emporium/db/migrate
directory:
class CreateAuthors < ActiveRecord::Migration
def self.up
create_table :authors do |t|
t.column :first_name, :string
t.column :last_name, :string
end
end
def self.down
drop_table :authors
end
end
When I try to run it by using the following command:
rake db/migrate
I get one line output as follows:
(in /home/bruparel/projects/emporium)
And nothing else. Unlike the book which shows the result of migration
script running.
I am trying to figure out why nothing is happening. The desired
outcome is off-course that a table called authors gets created in the
emporium_development database (I am using MySQL as instructed in the
book and to keep the things as simple as possible).
Here is the database yaml file:
# MySQL (default setup). Versions 4.1 and 5.0 are recommended.
Hello Bala,
Sorry for the trouble. It was my mistake. The book asks us to type in
rake db:migrate
Instead of that
I was typing
rake db/migrate
I just did not read the book right.
But something puzzles me. How in the world can someone figure out
looking at what log what is wrong. The feedback that rake provides on
the console does not have any indication of what is wrong. In other
words, I am asking if you or someone else can shed some light on how to
go about troubleshooting such problems?
Thanks again.
Regards,
Bharat
You need to have a basic understanding of the concepts about Ruby on
Rails. It will come with reading books and doing lot of exercises. You
learn by doing and making mistakes. Next time around you will know
what to watch out for.
I personally take notes from books, blogs etc and maintain a journal
for Ruby on Rails. I take printouts of the most important blog
postings and save them in a binder for easy reference. I have prinout
of all the cheatsheets for quick reference.
This way you will never say "I resolved the same problem few weeks
ago, but I dont remember what I did to sove it!" You will be more
productive and learn faster.
Log files can give clues to what is wrong. It is not the only thing
that will solve all problems.