R
RichardOnRails
Hi,
Below is my code, which works fine in Ruby 1.8.6 (with Rails 2.3.5),
except that sync and flush both return NoMethod. Have thos methods
been eliminated?
Thanks in Advance,
Richard
equire 'rubygems'
require 'active_record'
class Account < ActiveRecord::Base
set_table_name "accounts"
has_many :comments
end
class Comment < ActiveRecord::Base
set_table_name "comments"
belongs_to :account
end
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:database => 'test',
:username => 'root',
assword => "rlmrlm")
mylog = Logger.new('mylog.txt')
# mylog.sync = true # NoMethod
error
ActiveRecord::Base.logger = mylog
temp = Account.find(1)
mylog.info("Found a record with username: #{temp.username}" )
mylog.info('About to show comments')
temp.comments.each do |rec|
puts "#{temp.username} said #{rec.subject}"
end
#mylog.flush # NoMethod
error
Below is my code, which works fine in Ruby 1.8.6 (with Rails 2.3.5),
except that sync and flush both return NoMethod. Have thos methods
been eliminated?
Thanks in Advance,
Richard
equire 'rubygems'
require 'active_record'
class Account < ActiveRecord::Base
set_table_name "accounts"
has_many :comments
end
class Comment < ActiveRecord::Base
set_table_name "comments"
belongs_to :account
end
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:database => 'test',
:username => 'root',
assword => "rlmrlm")
mylog = Logger.new('mylog.txt')
# mylog.sync = true # NoMethod
error
ActiveRecord::Base.logger = mylog
temp = Account.find(1)
mylog.info("Found a record with username: #{temp.username}" )
mylog.info('About to show comments')
temp.comments.each do |rec|
puts "#{temp.username} said #{rec.subject}"
end
#mylog.flush # NoMethod
error