Run rake task in controller

Do anybody know how to run rake task in controller?

I've tried something like Rake::Task["db:migrate"].invoke but it
simply cannot handle it but give

RuntimeError: Don't know how to build task 'db:migrate'

How can I let the Rake::Task know the task list in Rails?

I've found it myself.

Just require more headers.

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'