Debugging CI errrors

Hello, new on Gitlab, so possibly a noob question (and apologies if this has already been asked by I couldn’t find any answers on searching).

I just migrated my Rails repo to Gitlab - pretty basic, no tests yet.
But it seems the CI pipeline seems to fail here:

$ rails db:migrate
rails aborted!
NameError: uninitialized constant ApplicationPolicy

Now the problem is that I can’t reproduce this in my local repo. So, I am not sure how best to debug this given that I didn’t think should be occurring in the first place. So, a few questions:

  1. How can I log in to the CI console to debug this?
  2. Any tips or idea what might be going on?
  3. How can I turn off CI if I need to (not per commit message, but in general for the project)?
  4. Are there any sample Rails (for API-only projects) .gitlab-ci.yml configs that can be shared?

Any help is much appreciated?