jeffrafter / simple_admin

Administration for Rails, simple.
Other
13 stars 5 forks source link

Registering admin interfaces while migrating causes migration errors #1

Closed jeffrafter closed 13 years ago

jeffrafter commented 13 years ago

rake db:migrate rake aborted! Mysql::Error: Table 'my_app_development.model_tables' doesn't exist: SHOW FIELDS FROM model_tables

Tasks: TOP => db:migrate => environment (See full trace by running task with --trace)

This is a problem.

jeffrafter commented 13 years ago

You can simply override the db:migrate task so that it disables the admin registration. Put the following before your Application.load_tasks in your Rakefile

task :disable_admin do
  module SimpleAdmin
    def SimpleAdmin.register(resource, options={}, &block)
      # Disable registrations
    end
  end
end

namespace :db do
  task :migrate => :disable_admin do
    # This is just a stub to change the prerequisites
  end
end