views:

115

answers:

2

Hello,

how can I use link_to_remote inside of a controller?

I have already included ActionView::Helpers::JavaScriptHelper, but still get the error:

undefined method `content_tag'

Thanks!

+1  A: 

You'll need to discover all of the helpers that need to be included to make it work. For instance, content_tag is part of ActionView::Helpers::TagHelper.

http://www.railsbrain.com/api/rails-2.2.2/doc/index.html?a=M002139&name=content_tag

It may be time to consider an alternative design.

Barry Hess
I have moved the code to the model, but link_to_remote doesn't work without defining an explicit host.
brainfck
A: 

Watch this screen cast by Ryan Bates: Helpers outside views

khelll