Hi All,
I am new to Ruby , ROR and NetBeans.
I am using Netbeans 6.5, Ruby 1.8 versions.
I created New Project in NetBeans by giving Project Name as DBTest,
selected Ruby Platform as Ruby 1.8.6-p111, server as Mongrel 1.1.5 and
in DataBase Configuration by selecting Specify Database Information
Directly (Database Adapter as mysql, DataBase Name as
DBTest_development, User Name as root ) .
And i Have 2 Model Classes : Book and Subject
My Book.rb class :
class Book < ActiveRecord::Base
belongs_to :subject
validates_presence_of :title
validates_numericality_of :price, :message=>“Error Message”
end
And my subject.rb class
class Subject < ActiveRecord::Base
end
And i created Migration classes for Book and Subject
20090423224145_books.rb file:
class Books < ActiveRecord::Migration
def self.up
create_table :books do |t|
t.string :title, :limit => 32, :null => false
t.float :price
t.integer :subject_id
t.text :description
t.timestamp :created_at
end
end
def self.down
end
end
20090423224238_subjects.rb file:
class Subjects < ActiveRecord::Migration
def self.up
create_table :subjects do |t|
t.string :name
end
Subject.create :name => “Physics”
Subject.create :name => “Mathematics”
Subject.create :name => “Chemistry”
Subject.create :name => “Psychology”
Subject.create :name => “Geography”
end
def self.down
end
end
And Now i am trying to create ths Tables from NetBeans by right clicking
on the project, selecting Run/Debug Rake Task(DB Test). And in that
Dialog box i selected db:create…
Now i am getting the error massege saying
Couldn’t create database for {“reconnect”=>false, “encoding”=>“utf8”,
“username”=>“root”, “adapter”=>“mysql”, “host”=>“localhost”,
“password”=>“root”, “database”=>“DBTest_development”, “pool”=>5},
charset: utf8, collation: utf8_general_ci (if you set the charset
manually, make sure you have a matching collation)
Can any one help me to solve this problem. Please let me know how to
solve ths. Your response is highly appreciated