How to create database from schema.rb without initializing Rails?

ruby, ruby-on-rails

Solution

You can add a check for the table existance in your initializer.

if TheModel.table_exists?
  // do something with the model
end

Problem

I am trying to create all my tables from schema.rb I used the command: "rake db:schema:load" However, this fails because in one of my initializers, it is referencing a model/table that obviously doesn't exist (since the database is empty) I could comment out these lines, and then run schema:load again, but is there an alternative?

Original source