Access url_for from rake task

How do I access ActionController:Base url_for method from a Rake task.
I tried to access ActionController from irb but it doesn’t work?
Check out the pasite http://pastie.caboo.se/131266

Anil, you can access url_for by doing this in your rake task:

task :my_task => :environment do
  include ActionController::UrlWriter
  default_url_options[:host] = 'www.mysite.com'

  url = url_for(:controller => 'blah', :action => 'blah')
end

Hi

I know using script/console would solve the problem. But I want this functionality outsite of the rails environment. I got the solution,
using include ActionController::UrlWriter, I am able to use url_for helper… In this case I have to pass :host too(or declare default_url_options[:host] = "
myhost.com". It works smoothly. But it is still under Rails environment, which gets loaded when I do task :my_task => :environment do ---- end. I this Rails has made this difficult to access the library(Rails related other gems) outside of the Rails environment. If there is some solution so that I could access it in IRB do reply

Thanks,