开发者

Rails 3- fixing juggernaut involving template and JS generator

开发者 https://www.devze.com 2023-01-21 14:02 出处:网络
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

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:

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

Thanks!


What's the reason you're not using Juggernaut 2? Legacy support?

0

精彩评论

暂无评论...
验证码 换一张
取 消