1

我安装了一个购物车 gem (Piggybak),它创建了一个名为create_orders......但我不再使用该 gem 的迁移,并添加了一个迁移以删除与 piggybak 相关的所有表。

但是,我正在尝试推出自己的购物车,当我创建一个新的迁移时create_order,即使它具有不同的时间戳,我也会收到此错误:

$ rake db:migrate
[RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
rake aborted!
Multiple migrations have the name CreateOrders

所以...我将迁移重命名为create_non_piggybak_orders,现在出现此错误:

rake aborted!
An error has occurred, this and all later migrations canceled:

uninitialized constant CreateNonPiggybakOrders/.rvm/gems/ruby-2.0.0-p0@myapp/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in `block in constantize'

处理这种情况的最佳方法是什么?

4

1 回答 1

1

打开迁移文件,将类名改为驼峰式匹配文件,即:

class CreateNonPiggybakOrders < ActiveRecord::Migration

于 2013-06-17T22:32:03.390 回答