Is there a Rails Console command (Rails 3+) to reload changed code?

前端 未结 2 1929
伪装坚强ぢ
伪装坚强ぢ 2020-12-13 12:17

I am playing with the console, I change some model code and now I want to test it. I normally re-start the console. Is there a quicker way? Maybe a console command to reload

相关标签:
2条回答
  • 2020-12-13 12:32

    Of course, simply type:

    reload!
    
    0 讨论(0)
  • 2020-12-13 12:48

    You need to call reload!

    This command will clear the loaded constants that have been loaded and will load them as they're referenced in the console.

    If you have old objects from before the reload! you will need to call reload on these individual objects or find new objects and work with them if you want to try out the new method.

    0 讨论(0)
提交回复
热议问题