gitlabhq/gitlab-ci — pull request #510 by kirrmann (2014-12-03 14:00:58+00:00)
Title: Undefined method last_build for running schedule_builds

I did a fresh installation of Gitlab-CI 5-2-stable on Ubuntu 14.04 Server. The whenever cronjob for scheduled builds always failed with to error message stated below.

```bash
gitlab_ci@st00166:~/gitlab-ci$ RAILS_ENV=production bundle exec rake schedule_builds --trace
** Invoke schedule_builds (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute schedule_builds
rake aborted!
NoMethodError: undefined method `last_build' for #
...
```

This is because the last_build only exists as method in Runner model.

The missing method error exists in 5-2-stable and master.