[Rails] initialize called more than once?

Abdur-Rahman Advany rails at advany.com
Thu Dec 15 23:50:42 GMT 2005


Well the controler gets created every time a action is called, HTTP is a 
stateless protocol : )

Danny Hendargo wrote:

> Hi,
>
> In my test case below, it seems that 'initialize' is called everytime 
> 'hello' is called. Is this by design, a bug, or my pilot error?
>
>    class FooController < ApplicationController
>
>        def initialize
>            print "\n initialize \n"
>        end
>
>        def hello
>            print "\n hello \n"
>        end
>    end
>
> I thought initialize will be called exactly once when the controller 
> is constructed and not when an action is executed.
>
> Thanks for your help and sorry if duplicate,
>
> -Danny
>
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



More information about the Rails mailing list