Using ERB inside a controller

I know it's not desirable to use ERB inside the controller in theory, but I think I really need and I'm having problems.

I am using GMap the Google Map helper and all the coding for the markers (pop-ups) is done inside the controller. So often you do something like:

markers << GMarker.new([obj.lat, obj.lng],           :title => obj.name,           :info_window => "Bob's House",           :icon => obj.gicon         )

but instead of a boring plain text in the info_window I wanted to use ajax links to dynamically update divs. Thus i would be nice to use e.g. link_to_remote and friends, but since that is in a view helper I can't use can I? Must I resort to raw javascript?

You can just include the relevant helper modules into your controller. Slightly more clean is to have a helpers object into which you include all those modules. You then have to say helpers.link_to_remote but you don't end up with dozens of methods added to your controller.

Fred