我想知道一些关于rails的对象生命周期的内容,每个请求可以指望一个新的实例吗?说每个Web请求创建一个新的控制器实例?(默认情况下)
解决方法
是的,您可以依赖每个请求的新控制器实例.
When your application receives a request,the routing will determine which controller and action to run,then Rails creates an instance of that controller and runs the method with the same name as the action.