1

I have an existing entry scaffold. I'd like to add image upload to my existing model/controller/view without too much hassle--and I'd like to add some ajax after I get it working.

That said, I'm pretty new to rails.

  1. I s there a simple, ajax-compatable gem to help?
  2. How do I implement it? (Step-by-step, because I'm pretty slow to learn)
Kevin Brown
  • 12,602
  • 34
  • 95
  • 155

3 Answers3

1

Ruby on Rails AJAX file upload

http://khamsouk.souvanlasy.com/articles/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent

Look for Step 6. Using iframes and responds_to_parent in the article. Note that it uses attachment_fu for handling file uploads. But the idea is same for both paperclip & carrierwave

Community
  • 1
  • 1
Arun Kumar Arjunan
  • 6,827
  • 32
  • 35
1

Here's a good demo of how to upload images with Rails 3. It uses Uploadify with the Dragonfly gem.

https://github.com/rdetert/FormFly

Dex
  • 12,527
  • 15
  • 69
  • 90
1

Same post AJAX upload using Prototype.js plugin

https://github.com/JangoSteve/remotipart

Remotipart is a Ruby on Rails gem enabling AJAX file uploads with jQuery in Rails 3.0 and Rails 3.1 remote forms. This gem augments the native Rails jQuery remote form functionality enabling asynchronous file uploads with little to no modification to your application.

gem 'remotipart', '~> 1.0'
bundle install
Community
  • 1
  • 1