J
Jose Pepe
# require AR
require 'rubygems'
require_gem 'activerecord'
ActiveRecord::Base.establish_connection({
:adapter => "mysql",
:database => "cocoa",
:socket => "/tmp/mysql.socket",
:username => <myusername>,
assword => <mypassword>
})
# define a simple model
class Task < ActiveRecord::Base
end
I am trying to run this script in ruby that reads a MySQL table, called
Tasks, like in this example:
http://wiki.rubyonrails.com/rails/pages/HowToUseActiveRecordOutsideRails
I got the following error message:
irb(main):001:0> Task.create "title" => "Item #1"
NameError: uninitialized constant Task
from (irb):1
require 'rubygems'
require_gem 'activerecord'
ActiveRecord::Base.establish_connection({
:adapter => "mysql",
:database => "cocoa",
:socket => "/tmp/mysql.socket",
:username => <myusername>,
})
# define a simple model
class Task < ActiveRecord::Base
end
I am trying to run this script in ruby that reads a MySQL table, called
Tasks, like in this example:
http://wiki.rubyonrails.com/rails/pages/HowToUseActiveRecordOutsideRails
I got the following error message:
irb(main):001:0> Task.create "title" => "Item #1"
NameError: uninitialized constant Task
from (irb):1