Rails migration to add boolean column to Postgres on Heroku
- by pmc255
I'm trying to execute a simple Rails migration to add a boolean column to an existing table. Here's the add_column call:
add_column :users, :soliciting, :boolean, :null => false, :default => false
However, after the migration runs (successfully, with no errors), I don't see the new column. If I go into the console and list the columns on the User table, for example, with this command:
>> User.columns.each { |c| puts "#{c.name} : #{c.type}" }
All the other columns show up, but not the one I just added with the migration. What's even more strange is that looking up a random user object yields the Postgres version of booleans (Ruby strings)
>> User.find(1).soliciting
=> "t"
However, the existing boolean columns all show up with standard Ruby boolean values of true and false.
What's going on here? Is the migration actually complete? Why doesn't the column show up, yet is accessible in the model objects?