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 http://anilwadghule.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
use script/console instead of irb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Dec 21, 2:11 am, "Anil Wadghule" <anildigi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 pasitehttp://pastie.caboo.se/131266 > > -- > Anilhttp://anilwadghule.com--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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, On Dec 21, 2007 3:48 PM, Thorsten Mueller <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > use script/console instead of irb > -- > Posted via http://www.ruby-forum.com/. > > > >-- Anil http://anilwadghule.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---