当将一些代码(大约 50 行)从 rake 任务复制到 Rails 控制台时,我希望它只在 Rails 控制台中运行代码,但是却发生了这种情况。第一部分是一些结果打印到屏幕上,但我不知道接下来会发生什么):
#<Appointment:0x00007fb83eec5358
id: "0f0e14a6-1645-4a7b-ad61-f799e60ac570",
doctor_id: 1,
patient_id: 1,
start_time: Sun, 24 Jan 2021 13:25:45 UTC +00:00,
end_time: Sun, 24 Jan 2021 14:25:45 UTC +00:00,
created_at: Sun, 24 Jan 2021 12:50:45 UTC +00:00,
updated_at: Sun, 24 Jan 2021 13:10:45 UTC +00:00]
...skipping...
SUMMARY OF LESS COMMANDS
Commands marked with * may be preceded by a number, N.
Notes in parentheses indicate the behavior if N is given.
A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.
h H Display this help.
q :q Q :Q ZZ Exit.
---------------------------------------------------------------------------
MOVING
e ^E j ^N CR * Forward one line (or N lines).
y ^Y k ^K ^P * Backward one line (or N lines).
发生了什么事,我该如何阻止它?
备注:
here提供的方式运行
Pry.config.pager = false
,但尽管如此,问题还是发生了。您陷入了检查模式。您可以在 IRB 中使用
进行检查 irb(main):001> conf.inspect_mode
=> true
你可以用
更改它irb(main):002> conf.inspect_mode = false
=> false