views:

9

answers:

0

Hi,

I'm using the original Juggernaut (not Juggernaut 2) with Rails 3. In the lib/juggernaut.rb, it breaks due to not being able to find @template. According to this other post, @template is not provided in controllers in Rails 3.

How can I fix the following code, so that it can run smoothly with Rails 3? (Here's a link to the original script. Look for render_with_juggernaut.)

      if @template.respond_to?(:_evaluate_assigns_and_ivars, true)
        @template.send(:_evaluate_assigns_and_ivars)
      else
        @template.send(:evaluate_assigns)
      end

      generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(@template, &block)            
      render_for_juggernaut(generator.to_s, options.is_a?(Hash) ? options[:juggernaut] : nil)

I'm thinking one of two things can be done:

  • get a hold of @template somehow
  • produce a snippet of JS without involving JavaScriptGenerator (which requires @template)

Do you have any suggestions on how to do one of these or other ways?

Thanks!