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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -