This error is due to the fact that some applications may specify different versions of gems than the ones you have installed.
Try using bundle exec rake db:migrate
.
Using bundle exec
guarantees that the program is run with the environment specified in the gemfile.