当我使用reload!
在Rails控制台中输入pry-rails
时,它似乎不起作用;即,我对代码所做的更改未实现。我读过的所有内容似乎都说pry-rails
gem自己实现了reload!
。
这是我的测试方式:(我在撬开的第1行和第2行之间的代码中放入了Deal.hello
)
// ♥ rails c
Running via Spring preloader in process 66760
Loading development environment (Rails 5.2.2)
[1] pry(main)> Deal.hello
NoMethodError: undefined method `hello' for Deal (call 'Deal.connection' to establish a connection):Class
from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.3.7/gems/activerecord-5.2.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
[2] pry(main)> Deal.hello
NoMethodError: undefined method `hello' for Deal (call 'Deal.connection' to establish a connection):Class
from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.3.7/gems/activerecord-5.2.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
[3] pry(main)> reload!
Reloading...
=> true
[4] pry(main)> Deal.hello
NoMethodError: undefined method `hello' for Deal (call 'Deal.connection' to establish a connection):Class
from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.3.7/gems/activerecord-5.2.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
[5] pry(main)> exit
[11:50:33] (deal-has-one-region) fares-you-can-use-rails
// ♥ rails c
Running via Spring preloader in process 66780
Loading development environment (Rails 5.2.2)
[1] pry(main)> Deal.hello
=> "hello"
[2] pry(main)>