When calling the column-related methods which modify a table's structure from ActiveRecord::ConnectionAdapters::SchemaStatements (i.e. add_column, remove_column, change_column, rename_column) not from a migration but from the application itself (i.e. when your application allows for table plasticity), the existing models remain with a stale definition - Take as an example the following console interaction:
>> Person
Person(id: integer, name: string)
>> Person.connection.add_column :people, :thing_id, :integer
=> []
>> Person
=> Person(id: integer, name: string)
To be able to use the new column, I have to do:
>> Person.reset_column_information
=> nil
>> Person
=> Person(id: integer, name: string, thing_id: integer)
So, what am I proposing? To modify the four mentioned methods so that, if there is a matching class defined in the current environment (i.e. no point in doing this when doing migrations, only if the classes have been brought to life), the model should be sent the reset_column_information.
The patch is trivial, I'm currently just checking it - but of course, I have not yet come up with a test case :) And I'd like some input before doing so.
In any case, expect my patch to appear here shortly.