Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.79 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Unable to render more than one line using Rails and Prototype
  2. *views/results/index.html.erb
  3. <%= link_to "#{school[:name]}", {:controller => "results", :action => "update", :school => school}, :remote => true%>
  4.        
  5. *controllers/results_controller.rb
  6. def update
  7.   @selection = params[:school]
  8.   respond_to do |format|
  9.     format.html {redirect_to :action => 'index'}
  10.     format.js
  11.   end
  12. end
  13.        
  14. *views/results/update.js.erb
  15. $("selected").update("<%= render :partial => '/results/academics', :locals => { :selection => @selection } %>")
  16.        
  17. *views/results/academics.html.erb
  18. <%= selection[:chances] %>
  19.        
  20. *views/results/academics.html.erb
  21. <%= selection[:chances] %>
  22. <br>
  23.        
  24. $("selected").update("<%= escape_javascript(render :partial => '/results/academics', :locals => { :selection => @selection }) %>")