From: Manivannan Jeganathan Date: 2010-12-04T18:46:09+09:00 Subject: Re: undefined method `debug' for nil:NilClass(NoMethodError Esen Sagynov wrote in post #930294: > I created very simple AR code to add new record to MySQL table. But I > get " undefined method `debug' for nil:NilClass(NoMethodError)". > > Here is the code: > ====================================== > require 'rubygems' > require 'active_record' > > ActiveRecord::Base.establish_connection( > :adapter => "mysql", > :host => "localhost", > :user => "root", > :password => "samplepass", > :database => "db_demo" > ) > > class City < ActiveRecord::Base > end > > City.create(:id => 4, :name => 'Washington') Hi, Have you solved this problem. Me also having same error. I don't get any error unless I manually input primary id Working code City.create(:name => 'Washington') Error code City.create(id=> 1 ,:name => 'Washington') RubyVersion: 1.8.1 Rails Version: 2.2.2 Gem Version: 1.3.2 Thanks in Advance -- Posted via http://www.ruby-forum.com/.