无法在rails控制台中生成迁移

时间:2015-02-21 03:25:01

标签: ruby-on-rails rails-console

出于某种原因,我突然无法从我的rails控制台生成迁移,并且不确定如何解释错误。我相信这与我早期尝试移除炼油厂cms时遇到的问题有关。

以下是错误示例:

2.1.3 :004 > rails g migration drop_refinery_images
NameError: undefined local variable or method `drop_refinery_images' for main:Object
from (irb):4
from /Users/user/.rvm/gems/ruby-2.1.3@global/gems/railties-4.1.6/lib/rails/commands/console.rb:90:in `start'
from /Users/user/.rvm/gems/ruby-2.1.3@global/gems/railties-4.1.6/lib/rails/commands/console.rb:9:in `start'
from /Users/user/.rvm/gems/ruby-2.1.3@global/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Users/user/.rvm/gems/ruby-2.1.3@global/gems/railties-    4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Users/user/.rvm/gems/ruby-2.1.3@global/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'

如果有人能解释如何解决这个问题或解释错误,我将不胜感激。 Refinery cms安装了一个rails引擎,这些表仍然存在于我的数据库中。我无法删除它们以及生成基本迁移。

1 个答案:

答案 0 :(得分:2)

从命令行运行rails g migration add_title_to_pin title:string,而不是从Rails控制台或IRB中运行。