# Not updating from migrate

**URL:** <https://www.ruby-forum.com/t/not-updating-from-migrate/144919>\
**Category:** Rails\
**Created:** [August 4, 2008, 11:25am UTC](https://www.ruby-forum.com/t/not-updating-from-migrate/144919 "2008-08-04T11:25:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e95f7d/32.png) [@phil](https://www.ruby-forum.com/u/phil)\
**Post date:** [August 4, 2008, 11:25am UTC](https://www.ruby-forum.com/t/not-updating-from-migrate/144919/1 "2008-08-04T11:25:08Z")

</div>

This code runs:

def self.up  
add\_column :film\_languages, :short\_code, :string

```
fl = FilmLanguage.find_by_language("spanish")
fl.short_code = "es"
fl.save

fl = FilmLanguage.find_by_language("english")
fl.short_code = "en"
fl.save

```

end

but doesn’t update short\_code:  
[4;35;1mSQL (0.000191) [0m [0mSELECT version FROM  
schema\_migrations [0m  
[4;36;1mSQL (0.006109) [0m [0;1mALTER TABLE `film_languages` ADD  
`short_code` varchar(255) [0m  
[4;35;1mFilmLanguage Load (0.000338) [0m [0mSELECT \* FROM  
`film_languages` WHERE (`film_languages`.`language` = ‘spanish’) LIMIT  
1 [0m  
[4;36;1mSQL (0.000054) [0m [0;1mBEGIN [0m  
[4;35;1mSQL (0.000284) [0m [0mSELECT `language` FROM  
`film_languages` WHERE (`film_languages`.language = ‘spanish’ AND  
`film_languages`.id \<\> 2) [0m  
[4;36;1mFilmLanguage Update (0.000139) [0m [0;1mUPDATE  
`film_languages` SET `updated_at` = ‘2008-08-04 09:21:34’,  
`created_at` = ‘2008-08-04 09:21:34’, `language` = ‘spanish’ WHERE  
`id` = 2 [0m  
[4;35;1mSQL (0.000081) [0m [0mCOMMIT [0m

But if I go into console it works fine. Does the migration not know  
about the column or something at the time this is run (before commit  
perhaps?)

---

<div class="post-metadata">

**Author:** ![phil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e95f7d/32.png) [@phil](https://www.ruby-forum.com/u/phil)\
**Post date:** [August 4, 2008, 12:45pm UTC](https://www.ruby-forum.com/t/not-updating-from-migrate/144919/2 "2008-08-04T12:45:57Z")

</div>

Have you tried FilmLanguage.reset\_column\_information after you’ve  
added the column ? (check spelling, haven’t got access to the docs here)

Sent from my iPhone

---

<div class="post-metadata">

**Author:** ![phil](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e95f7d/32.png) [@phil](https://www.ruby-forum.com/u/phil)\
**Post date:** [August 4, 2008, 2:13pm UTC](https://www.ruby-forum.com/t/not-updating-from-migrate/144919/3 "2008-08-04T14:13:52Z")

</div>

Thanks,  
I am going to try that, thought [http://dev.rubyonrails.org/ticket/9436](http://dev.rubyonrails.org/ticket/9436)  
seems to imply that it has been fixed… but its not working here!

On Aug 4, 12:45 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
