nil object error for "rake db:migrate"

I'm going to start removing relationships and data-entry during the migration, but where's this nil object coming from?

Is it because of the relationship, or is there something wrong with the way data is entered during the migration? I'm not seeing what would introduce the nil object :frowning:

thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ sqlite3 db/development.sqlite3 SQLite version 3.4.1 Enter ".help" for instructions

.schema

CREATE TABLE schema_info (version integer);

.quit

thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ rake db:migrate VERSION=0 (in /home/thufir/goodfellow-tool) thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ rake db:migrate
(in /home/thufir/goodfellow-tool) rake aborted! You have a nil object when you didn't expect it! The error occurred while evaluating nil.-@

(See full trace by running task with --trace) thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ cat db/migrate/001_calls.rb -class Calls < ActiveRecord::Migration         def self.up                 create_table "calls" do |call|                         call.column "login", :string                         call.column "start", :datetime                         call.column "comment", :string                 end

                Call.create :login => "0123",                                 :start => "Mon Jan 01 16:00:00 -0800 2007",                                 :comment => "start work"

                Call.create :login => "0123",                                 :start => "Mon Jan 01 17:00:00 -0800 2007",                                 :comment => "call received"

                Call.create :login => "0123",                                 :start => "Mon Jan 01 19:00:00 -0800 2007",                                 :comment => "call ended"

                Call.create :login => "0123",                                 :start => "Mon Jan 01 22:00:00 -0800 2007",                                 :comment => "end work"

                Call.create :login => "1234",                                 :start => "Mon Jan 01 22:00:00 -0800 2007",                                 :comment => "start"         end

        def self.down                 drop_table "calls"         end end thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ cat db/migrate/002_employees.rb class Employees < ActiveRecord::Migration         def self.up                 create_table "employees" do |employee|                         employee.column "code", :string                         employee.column "first_name", :string                         employee.column "last_name", :string                 end

                Employee.create :code => "abc123",                                                 :first_name => "John",                                                 :last_name => "Doe"

                Employee.create :code => "abc321",                                                 :first_name => "Jane",                                                 :last_name => "Doe"         end

        def self.down                 drop_table "employees"         end end thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ cat db/migrate/003_logins.rb
class Logins < ActiveRecord::Migration         def self.up                 create_table "logins" do |login|                         login.column "login", :string                         login.column "employee_id", :string                 end

                Login.create :login => "0123",                                         :employee_id => "abc123"         end

        def self.down                 drop_table "logins"         end end thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ cat app/models/call.rb class Call < ActiveRecord::Base         belongs_to :login end thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ cat app/models/login.rb class Login < ActiveRecord::Base         belongs_to :employee         has_many :call end thufir@arrakis ~/goodfellow-tool $ thufir@arrakis ~/goodfellow-tool $ cat app/models/employee.rb class Employee < ActiveRecord::Base         has_many :login end thufir@arrakis ~/goodfellow-tool $

thanks,

Thufir