Hello,
I want to make a new Rails application, but I hate SQL. So I wanted to
know if it was possible to do that with Ruby itself. To create the data
structure, I have the following script:
require “rubygems”
require “active_record”
ActiveRecord::Base.establish_connection({
:adapter => “mysql”,
:host => “localhost”,
:database =>
“cwh_development”,
:username => “root”
})
ActiveRecord::Schema.define do
create_table :languages do |t|
t.column :name, :string
end
create_table :approvers do |t|
t.column :name, :string
t.column :username, :string
t.column :password, :string
t.column :email, :string
end
create_table :words do |t|
t.column :word, :string
t.column :definition, :text
t.column :approver_id, :integer
t.column :language_id, :integer
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
How does that script look? Is there anything I could do to improve it?
Also, I have a large dictionary file with one word per line that I would
want to import into the words table. Is there an easy way to do that
with Ruby and ActiveRecord?
Many thanks guys,
Vincent.