From: Esen Sagynov Date: 2010-08-04T11:59:52+09:00 Subject: undefined method `debug' for nil:NilClass(NoMethodError 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') last_city = City.find(:last) if last_city puts %{#{last_city.name} is the last city} else puts "There is no any City." end ====================================== The code is so simple just like explained in (http://rubylearning.com/satishtalim/ruby_activerecord_and_mysql.html) and in the Ruby AR documentation. But that undefined method error pops up anyway. I actually, so many developers encounter the same problem. Still cannot find the solution. Any suggestion is appreciated. -- Posted via http://www.ruby-forum.com/.