Skip to content

Instantly share code, notes, and snippets.

@masnick

masnick/gist:463836

Created Jul 4, 2010
Embed
What would you like to do?
#
#
# test.rb
#
#
require 'rubygems'
require 'active_record'
require 'classifier'
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:database => 'db',
:username => 'root',
:password => 'pw',
:host => 'localhost')
ActiveRecord::Base.logger = Logger.new(STDERR)
class User < ActiveRecord::Base
end
puts User.all
#
#
# SQL Dump
#
#
# DROP TABLE IF EXISTS `users`;
#
# CREATE TABLE `users` (
# `id` int(11) NOT NULL AUTO_INCREMENT,
# `name` varchar(255) DEFAULT NULL,
# PRIMARY KEY (`id`)
# ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
#
# LOCK TABLES `users` WRITE;
# /*!40000 ALTER TABLE `users` DISABLE KEYS */;
# INSERT INTO `users` (`id`,`name`)
# VALUES
# (1,'test1'),
# (2,'test2');
#
# /*!40000 ALTER TABLE `users` ENABLE KEYS */;
# UNLOCK TABLES;
#
#
# Output
#
#
# SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
# User Load (0.2ms) SELECT * FROM `users`
# User Columns (3.2ms) SHOW FIELDS FROM `users`
# /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:102:in `sum': wrong number of arguments (1 for 0) (ArgumentError)
# from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:102:in `instance_method_already_implemented?'
# from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:72:in `define_attribute_methods'
# from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:71:in `each'
# from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:71:in `define_attribute_methods'
# from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/attribute_methods.rb:355:in `respond_to?'
# from tmp.rb:20:in `puts'
# from tmp.rb:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment