Trying to load a db table with sample data... This seems like a very simple and straitforward task. require ''rubygems'' require ''active_record'' class Rich < ActiveRecord::Base end class Corp < ActiveRecord::Base end ActiveRecord::Base.establish_connection( :adapter => "mysql", :host => "localhost", :username => "root", :password => "", :database => "foo_development" ) @x = Rich.find(:all) @x.each { |a | n = Corp.new n["name"] = a["name"] n["city"] = a["city"] n["state"] = a["state"] n["zip"] = a["zip"] n.save; } # Just before executing the n.save line... (rdb:1) p n #<Corp:0x2a0bbe4 @attributes={"city"=>"San Jose", "name"=>"Wire Inc", "status"=>nil, "zip"=>"95131-1873", "address2"=>nil, "cf"=>nil, "notes"=>nil, "market"=>nil, "isp"=>nil, "domain_name"=>nil, "fax"=>nil, "phone"=>nil, "circuit_type"=>nil, "address"=>nil, "source"=>nil, "state"=>"CA"}, @new_record=true> (rdb:1) n Error: /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:2068: `can''t clone NilClass'' (TypeError) from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:2037:in `quoted_column_names'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1741:in `create_without_callbacks'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:265:in `create_without_timestamps'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/timestamp.rb:30:in `create'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1718:in `create_or_update_without_callbacks'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:253:in `create_or_update'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1392:in `save_without_validation'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/validations.rb:736:in `save_without_transactions'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:126:in `save'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:126:in `transaction'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:91:in `transaction'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:118:in `transaction'' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/transactions.rb:126:in `save'' from populateCorp.rb:28 from populateCorp.rb:20:in `each'' from populateCorp.rb:20 /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:2068: value.clone --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---