Recently a coworker asked if there was a simple way to get the current version out of the schema_info table. Of course, one simple answer is to simply look in the database.
However, if you want to quickly pull the version from a command line, this rake task should do the trick:
namespace :db do
desc "Returns the current schema version"
task :version => :environment do
connection = ActiveRecord::Base.connection
select = 'select * from schema_info'
version_num = connection.execute(select).result.flatten.first.to_i
puts "Current version: " + version_num.to_s
end
end