The Decider said on Mon Jul 30 14:18:50 +0000 2007 | permalink
Tagged: migration version schema_info SchemaInfo

Getting at schema_info or SchemaInfo

I’m writing a utility that will be executed using script/runner and needed to get at the table schema_info where the migration version is held. This worked:

class SchemaInfo < ActiveRecord::Base set_table_name :schema_info set_primary_key :version attr_accessor :version def version_before_type_cast end def self.version self.find(:first).id end end
[1514][chadb@Jokerman:~/Sites/surveil/trunk]$ script/console
Loading development environment.
>> SchemaInfo.version
=> 149
>> quit