Not updating from migrate

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?)

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

Thanks,
I am going to try that, thought 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. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs