Hi currently I am upgrading my project from rails 3.2 to rails 4. After upgrading to rails 4. page.replace_html
method is not working property.
eg:
In controller if it encountered code like this,
render :update do |page|
page.replace_html "lease_container", :partial => "/lease/property_pipeline", :locals => {:note_collection => @note}
end
it throws error like this,
ActionView::MissingTemplate (Missing template lease/update, application/update with {:locale=>[:en], :formats=>[:js, :html, :xml, :html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :rjs]}
how could i resolve this?. Is there any alternative to do this with jquery?
use prototype-rails helper gem
Still better, refactor the code to use jQuery. Rails now encourages UJS (Un Obtrusive JavaScript). So an exact replacement syntax in jQuery may not be desirable.
You can try something like this
$("#divid").html("<div>all the html goes here</div>")
This will replace the contents of a <div id="divid">....</div>
with what is passed into .html("....")
Here is the jQuery documentation for .html()
There is a nice RailsCasts Episode #205 on this topic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With