ruby - Rails calling Models in the Migration -
i have migration creates table, , need access model table create table. migration seems not recognized original table has been created, make sure put debugger in code , when model call, says user(table doesn't exist)
though in mysql see being created. looks migrations can't see current state of database, ideas how around that?
just more specific question: i'm trying use archivist create archive of current user table have
class archivedheuristicreviewstable < activerecord::migration def self.up create_table "users" |t| t.string "name" ... end debugger archivist.update user end def self.down drop_table :users drop_table :archived_users end end
the archivist, doesn't create archived_user table, when stopped @ debugger , did user, got user(table doesn't exist)
.
i tried archivist call in newer migration, make sure user creation done, still didn't recognize user table.
any ideas?
this should trick:
user.connection.schema_cache.clear! user.reset_column_information
Comments
Post a Comment