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

Lee Mallabone lee at crossbonesystems.com
Thu Jan 29 11:26:07 EST 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: link_to_issue.rb
Type: text/x-ruby-script
Size: 230 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090129/68d4cc4f/attachment.bin>


More information about the Facebooker-talk mailing list