开发者

how to have ruby console recognize code changes in controllers and models

开发者 https://www.devze.com 2023-02-09 03:25 出处:网络
I\'m adding new functionality to my ruby model and testing it through the ruby console as I go. I find it very annoying to have to restart the console everytime I change anything in the model. Is ther

I'm adding new functionality to my ruby model and testing it through the ruby console as I go. I find it very annoying to have to restart the console everytime I change anything in the model. Is there a way to have the ruby console not cache or have it check for updated code without restarting it?

For example, I'm making a new method in the model, and after I make a change, I have to restart the console and run a few commands to load everything back up again. See below:

script/console
require 'some_gem'
r = Region.find_by_name("some_region")
r.some_method

If I change a line in the high_x method from the region model, I have to repeat all of the steps to see my chang开发者_运维问答e.


Just type:

reload!

This will ... reload :)

0

精彩评论

暂无评论...
验证码 换一张
取 消