在特定的时间需要重新启动Webrick来查看所做的更改是否正确? [英] Is it correct that there are particular times when you may need to restart Webrick to see your changes?

查看:92
本文介绍了在特定的时间需要重新启动Webrick来查看所做的更改是否正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说Kevin Skoglund(lynda.com)说,养成在开发过程中经常重新启动Webrick的习惯是一种好习惯。尽管通常不需要重启Webrick即可查看所做的更改,但他暗示在某些特定时间可能需要这样做?有谁知道这些情况可能是什么?

I heard Kevin Skoglund (lynda.com) say that it is good practice to get in the habit of restarting Webrick frequently during development. Although generally you do not need to restart Webrick to see your changes, he implied that there are particular times when this may be needed? Does anyone know what those circumstances might be? This made wonder if Webrick is kind of flaky.

推荐答案

如果您正在学习Lynda.com教程,那么您正在工作。 Rails的版本要早于最新版本(2.3.2)。

If you are working through the Lynda.com tutorials, then you are working with a much earlier version of Rails then the most recent release (2.3.2).

简单的答案是,在开发环境中工作时,不再需要大量重新启动。我认为Kevin每次更改Model对象时都会重新启动服务器,但现在不再如此了。

The short answer is, large amounts of restarts are no longer necessary when working in the development environment. I think Kevin has you restart the server every time you change a Model object, but that isn't the case anymore.

一般的经验法则是:每次在config或lib文件夹中进行更改时,都要重新启动。 。 。其他任何代码更改均无需重启。当您同时更改routes.rb文件时,重新启动也是个好主意,尽管今天使用它时,我注意到这并不是一个硬性规定。

The general rule of thumb is: restart every time you change something in the config or lib folder . . . any other code changes shouldn't necessitate a restart. It is also a good idea to restart when you change your routes.rb file as well, although when working with it today I noticed it is not a hard and fast rule.

所有服务器重新启动的原因不一定是因为您的Web服务器(webrick,mongrel,phusion passenger)不稳定,而是因为当Rails应用启动时,某些内容会加载到内存,加载路径,初始化程序,环境数据中。当您更改其中一个文件时,您想重新启动应用程序以便进行更改(与仍在内存中运行的旧文件相对)

The reason for all of the server restarts isn't necessarily because your webserver (webrick, mongrel, phusion passenger) is flaky, but because when your Rails app has started up, there are certain things loaded into memory, load paths, initializers, environment data. When you make a change to one of these files, you want to restart your application so that the changes take place (as opposed to the old stuff that is still running in memory)

这篇关于在特定的时间需要重新启动Webrick来查看所做的更改是否正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆