Substituí prototipo con jQuery para Rails 3. Ahora estoy tratando de hacer lo siguiente:Rails 3 jQuery page.insert_html y TypeError: Element.insert no es una función
#photo
=render 'shared/photo'
= link_to_function "Add a Photo" do |page| |
page.insert_html :bottom, 'photo', :partial => 'shared/photo', :object => Photo.new |
end |
Así que el Javascript es generada :
try {
Element.insert("photo", {
bottom: "Data\n\n"
});
} catch (e) {
alert('RJS error:\n\n' + e.toString());
alert('Element.insert(\"photo\", { bottom: \"Data\\n\\n\" });');
throw e
};
return false;
En el insert_html carriles Docs es un ayudante del prototipo, pero pensé que la sustitución de rails.js con el https://github.com/rails/jquery-ujs reemplazaría esta ayudantes para ayudantes jQuery. Obtengo un TypeError.ElementInsert no es una función.
¿Estoy haciendo algo mal? ¿O voy a hacer esto yo mismo sin los ayudantes?