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.
-- 
Posted via http://www.ruby-forum.com/.
Anyone? -- Posted via http://www.ruby-forum.com/.
gnuvince wrote:> Anyone?Well, you can just put your ActiveRecord::Schema.define do..end in db/schema.rb and run rake db_schema_import. -- Posted via http://www.ruby-forum.com/.
gnuvince wrote:> 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:How about ActiveRecord::Migration and rake migrate? http://api.rubyonrails.com/classes/ActiveRecord/Migration.html -- Posted via http://www.ruby-forum.com/.
> How about ActiveRecord::Migration and rake migrate?Anyone? -- Posted via http://www.ruby-forum.com/.
gnuvince wrote:> 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 > ...This looks a lot like Og, see http://www.rubygarden.org/index.cgi/Libraries/og_tutorial.rdoc. Danny (blog.dannynet.net) -- Posted via http://www.ruby-forum.com/.