[Facebooker-talk] link_to issue when running outside of web server

Mike Mangino mmangino at elevatedrails.com
Thu Jan 29 14:01:56 EST 2009


There is a lot of magic required to make those helpers work. You will  
probably need to include the facebooker helpers. The Publisher code  
sets up a class with all of the helpers available, you might try  
looking at that.

Mike

On Jan 29, 2009, at 11:26 AM, Lee Mallabone wrote:

> Hi all,
>
> I've created a class that I want to run outside of my web server using
> the standard rails "script/runner".
>
> The script works fine, loading ActiveRecord objects etc, until I try
> and use the link_to helper.
>
> I've included the following in my class:
>    include ActionView::Helpers::UrlHelper
>    include ActionController::UrlWriter
> but when I try and call link_to I get the following error:
>
> /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ 
> url_rewriter.rb:138:in
> `url_for': Missing host to link to! Please provide :host parameter or
> set default_url_options[:host] (RuntimeError)
>
> I'm calling link_to like this:
> link_to('link test', :canvas => true, :controller => :job, :action =>
> :show, :id => user_job)
>
> It almost looks as though facebooker's URL helper methods are not
> getting mixed in properly, so it's not picking up facebooker's host or
> canvas prefix. Anyone know how to fix this? I've attached a tiny class
> that demonstrates the problem in my environment. run it with:
> script/runner /path/to/link_to_issue.rb
>
> Regards,
> Lee.
>
> -- 
> Lee Mallabone.
> Crossbone Systems Ltd.
>
> Tired of hunting for great people?
> Post jobs on your facebook profile with Head Hunting:
> http://apps.facebook.com/headhunting/pages/recruiter
> <link_to_issue.rb>_______________________________________________
> Facebooker-talk mailing list
> Facebooker-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/facebooker-talk

--
Mike Mangino
http://www.elevatedrails.com





More information about the Facebooker-talk mailing list