当尝试在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多行支持的解决方案,当粘贴长行时中断。
技巧是将所有参数作为单个参数传递给heroku run:
heroku run "rails console -- --nomultiline"