From: Thufir Date: 2007-12-22T17:12:30+09:00 Subject: undefined method `create' I want to create one creature and write it to the dwemthys.db, and I'm close. From the example at I know that the "create" method is used for this, but somehow it fails when for creatures when it works for the example. All code is at , but this is what I'm running into: thufir@arrakis ~/Desktop/dwemthys $ thufir@arrakis ~/Desktop/dwemthys $ ruby creatures.rb -- create_table(:creatures) SQL (0.016574) CREATE TABLE creatures ("id" INTEGER PRIMARY KEY NOT NULL, "life" integer DEFAULT NULL, "strength" integer DEFAULT NULL, "charisma" integer DEFAULT NULL, "weapon" integer DEFAULT NULL) -> 0.1334s creatures.rb:28: undefined method `create' for Creature:Class (NoMethodError) thufir@arrakis ~/Desktop/dwemthys $ thufir@arrakis ~/Desktop/dwemthys $ cat creatures.rb require 'active_record' require 'ArrayOfCreatures' require 'MakeCreature' require 'Creature' include MakeCreature ActiveRecord::Base.logger = Logger.new(STDERR) ActiveRecord::Base.colorize_logging = true ActiveRecord::Base.establish_connection( :adapter => "sqlite3", :dbfile => "dwemthys.db" ) ActiveRecord::Schema.define do create_table :creatures do |table| table.column :life, :integer table.column :strength, :integer table.column :charisma, :integer table.column :weapon, :integer end end creature = Creature.create thufir@arrakis ~/Desktop/dwemthys $ thufir@arrakis ~/Desktop/dwemthys $ cat Creature.rb require 'Math' class Creature Creature.extend Math include Math attr_accessor :life, :strength, :charisma, :weapon def initialize () @life = 10 @strength = 10 @charisma = 10 @weapon = 10 end def toString () print "class\t\t" print self.class print "\nlife\t\t" print @life print "\nstrength\t" print @strength print "\ncharisma\t" print @charisma print "\nweapon\t\t" print @weapon print "\n" end end thufir@arrakis ~/Desktop/dwemthys $ thufir@arrakis ~/Desktop/dwemthys $ thanks, Thufir