如何将选项传递给heroku中的rails控制台
Posted
技术标签:
【中文标题】如何将选项传递给heroku中的rails控制台【英文标题】:how can options be passed to rails console in heroku 【发布时间】:2021-11-15 17:20:35 【问题描述】:在 Heroku 中尝试将选项传递给 rails console
时,显示以下错误:
> heroku run rails console -- --nomultiline
Running rails console "-- --nomultiline" on ⬢ the-app... up, run.512 (Standard-1X)
Traceback (most recent call last):
...
/app/vendor/bundle/ruby/2.7.0/gems/railties-6.1.4/lib/rails/commands/console/console_command.rb:95:in `perform': wrong number of arguments (given 1, expected 0) (ArgumentError)
...
/app/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:525:in `handle_argument_error': ERROR: "rails console" was called with arguments ["-- --nomultiline"] (Thor::InvocationError)
这是 IRB 多行支持在粘贴长行时中断的解决方法。
【问题讨论】:
【参考方案1】:诀窍是将所有参数作为一个单独的参数传递给heroku run:
heroku run "rails console -- --nomultiline"
【讨论】:
以上是关于如何将选项传递给heroku中的rails控制台的主要内容,如果未能解决你的问题,请参考以下文章
无法使用 Attachinary 在 Heroku 上运行 Rails 控制台:未定义方法 `respond_to' for Attachinary::CorsController:Class
如何将访问代码从 gmail api 传递给 Heroku 中的节点工作者
Rails Twilio App 在运行时在heroku 中发送文本时挂起,但在heroku 上的rail 控制台中工作(以及在所有环境中的本地)