Quantcast
Channel: Notes posted by marcelo_murad
Viewing all articles
Browse latest Browse all 2

To verify if the element exists before replacing. (ActionView::Helpers::PrototypeHelper::JavaScriptGenerator::GeneratorMethods#replace_html)

$
0
0

Just add this code into a initializer file.

Atention: The code starts at the “module ActionView” and the last “end” has to be copied too.

module ActionView

module Helpers
  module PrototypeHelper
    class JavaScriptGenerator #:nodoc:
      module GeneratorMethods
        def replace_html_if_exists(id, *options_for_render)
          call "if($('#{id}')) Element.update", id, render(*options_for_render)
        end
      end
    end
  end
end

end


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images