code_junkie

AJAX, Rails, and dynamic loading of forms

Nov 11th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. <div id="preview"> </div>
  2.  
  3. <%= link_to_remote image_tag('whatever.jpg'),
  4. {:controller => 'something', :action => 'replace_thumbnail', :id => @thumbnail.id},
  5. :update => 'preview' %>
  6.  
  7. def replace_thumbnail
  8. image = Image.find(params[:id])
  9. render :partial => 'edit', :object => image, :layout => false
  10. end
Add Comment
Please, Sign In to add comment