Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 接受用户';s输入_Ruby On Rails_Ruby On Rails 3_Heroku_Migration_Rails Migrations - Fatal编程技术网

Ruby on rails 接受用户';s输入

Ruby on rails 接受用户';s输入,ruby-on-rails,ruby-on-rails-3,heroku,migration,rails-migrations,Ruby On Rails,Ruby On Rails 3,Heroku,Migration,Rails Migrations,我有一个Rails迁移,如下所示: puts "*** What would you like to do? ***" puts "(a)dd columns AND copy data" puts "(c)olumns only (no data copying)" puts "(d)ata only (no column adding)" puts "(q)uit" reply = $stdin.gets.chomp ... (subsequent code depends on the r

我有一个Rails迁移,如下所示:

puts "*** What would you like to do? ***"
puts "(a)dd columns AND copy data"
puts "(c)olumns only (no data copying)"
puts "(d)ata only (no column adding)"
puts "(q)uit"
reply = $stdin.gets.chomp
...
(subsequent code depends on the reply variable)
这在我的开发系统上起作用

当我打一封信时,Heroku不接受我的回复,因为它给了我上面的文本作为提示

我怎样才能让它在Heroku上工作?

而不是运行

heroku rake db:migrate
运行:


然后您可以运行交互式迁移。

这似乎偏离了迁移的主要承诺;它们是数据库模式发生了什么的记录。如果您在迁移过程中接受输入以决定要做什么,那么以后就无法跟踪它了。你为什么需要它?@anthonybishopriac此迁移改变了网站处理其主要功能之一的方式(数据从一组数据库表移动到另一组数据库表)。在我们的生产系统中,数据必须随着迁移的数据库更改而即时传输,因此我们允许通过此迁移进行数据传输。@AnthonyBishopric另一件事是,如果此迁移必须重做、回滚等,则只能选择更改数据库,或者只重新复制信息,这非常重要,否则数据可能会丢失或损坏。
heroku run bash