500 when using url_for helper in controllers initialize

It seems like you can't use the url_for helper in the initialize
method of a controller:

class TestController < ApplicationController
  def initialize
    @somevar = url_for ( :action => 'index' ) #<=== This errors out
for some reason
  end

  def some_method
    @somevar = url_for ( :action => 'index' ) #<=== but this works
  end
end

Any idea why this is happening? Is there a known work around?

Thanks

Rafael

thanks

If you use/d named routes you can/could just use index_url instead of having to assign a variable.

RSL