# Nil.to\_sym when migrating?

**URL:** <https://www.ruby-forum.com/t/nil-to-sym-when-migrating/136535>\
**Category:** Rails\
**Created:** [May 3, 2008, 7:30am UTC](https://www.ruby-forum.com/t/nil-to-sym-when-migrating/136535 "2008-05-03T07:30:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/82dd89/32.png) [@jeremy](https://www.ruby-forum.com/u/jeremy)\
**Post date:** [May 3, 2008, 7:30am UTC](https://www.ruby-forum.com/t/nil-to-sym-when-migrating/136535/1 "2008-05-03T07:30:21Z")

</div>

For whatever reason I’m getting the following when attempting to run a  
migration:

–rename\_column(:listings, :listed\_by, :agent\_id)  
rake aborted!  
You have a nil object when you didn’t expect it!  
The error occured while evaluating nil.to\_sym

The migration itself looks like this:  
class CorrectColumnType \< ActiveRecord::Migration  
def self.up  
rename\_column :listings, :listed\_by, :agent\_id  
end

def self.down  
rename\_column :listings, :agent\_id, :listed\_by  
end  
end

The table ‘listings’ and column ‘listed\_by’ do exist and the code  
makes use of it fine–I just want to rename that column and can’t.

Any ideas why?

---

<div class="post-metadata">

**Author:** ![jeremy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/82dd89/32.png) [@jeremy](https://www.ruby-forum.com/u/jeremy)\
**Post date:** [May 5, 2008, 6:33am UTC](https://www.ruby-forum.com/t/nil-to-sym-when-migrating/136535/2 "2008-05-05T06:33:26Z")

</div>

the agent\_id ? rerun with --trace
