Ok I have been trying to get started with Ruby on Rails and I want to
tie it together with a mysql database. I have been using the
examples in teh Agile Web Developkent with Rails, which has you setup
the database.yml file and run rake db:migrate to make sure you can
connect.
Well this all works great.
Next you create a model using script/generate model Account
Once this is created if you run rake db:migrate it will fail. Giving
you an unitialized constant CreateAccount error.
After doing some research online it appears the the file that is
generated is named wrong and that is much exactly match the name of
the class definition inside the migration file.
The generated file is 001_create_accounts.rb
/************ Migration File 001_create_accounts.rb
class CreateAccounts < ActiveRecord::Migration
def self.up
create_table :accounts do |t|
end
end
def self.down
drop_table :accounts
end
end
/*************************
I renamed the file to 001_CreateAccounts.rb, however now I get this :
vincent-cordaros-computer:~/Development/WorkSpace/rails/mymeetingstone
Storm$ rake db:migrate – trace
(in /Users/Storm/Development/WorkSpace/rails/mymeetingstone)
* config.breakpoint_server has been deprecated and has no
effect. *
rake aborted!
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.first
Anyone have any ideas or can point me to a good working code example.
I just really want to leverage the object relational mapping
of Rails.