Notes posted by marcelo_murad
RSS feed
marcelo_murad -
July 5, 2009
2 thanks
To verify if the element exists before replacing.
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
marcelo_murad -
July 1, 2009
4 thanks