Multi file upload with Uploadify and Carrierwave on Rails 3. I have been using Paperclip to upload images in Rails apps for about 2-3 years now. Recently after watching CarrierWave File Uploads screencast by Ryan Bates, I got interested to try it out. However, I wished to extend it a bit more and add support for multi-file uploads with Uploadify . Luckily, I had an old application based on Rails 2, Paperclip, and old version of Uploadify. Although, I got it working with the new components, I do not have this application published anywhere. Hence, this blog post only provides general guidelines and code snippets, which will help you implementing multi-file uploading very quickly. Assuming you have a functional Rails 3 app with Jquery, jquery-rails , and a model, which requires attached images - let’s name it a Property model. Required Gems Go ahead and update your Gemfile : ... gem 'carrierwave' gem 'mini_magick' gem 'flash_cookie_session' ...
Generating models We will need a Photo model to store the photos and Carrierwave uploader. Class PhotoUploader. AJAX file uploads in Rails using attachment_fu and responds_to_parent - Khamsouk Souvanlasy. Step 1.
Choose a file upload plugin Sure, you can write one yourself (or bake the code directly into your app), but unless you have specific requirements you should take a look at what’s available. Even if you do have a good excuse, you can learn from the existing plugins or extend them. The three that I’ve used over the past two years are: file_column – the first file upload plugin available for Rails that I know of, it handles saving files to the filesystem, resizing of images, creation of thumbnails, and integration with rmagick; however it doesn’t seem to be in active development. acts_as_attachment – written by Rick Olson, it does everything that file_column can, but with a cleaner and extensible code base. attachment_fu – is a rewrite of acts_as_attachment adding a plugin architecture to extend it to add different image processors (image_science, mini_magick and rmagick are provided) and storage backends (database, file system, and Amazon S3).
Step 2. Step 3. Step 4. Step 5. Cucumber - Making BDD fun. Akdemia. Integration Test. Following UnitTest of a subsystem, IntegrationTest evaluates that subsystem as integrated within a larger subsystem or within the complete system, testing interdependencies with other subsystems, including other project and third party libraries, tools, etc.
Note the "following" verbiage implies you pass the unit tests before running the FunctionalTests, then the IntegrationTests. This implies a test failure, with well-defined units, should only implicate the interface between the units. Alternately: smoke test the whole thing to see if it screws up now that some subsystem has changed; just because it passed UnitTest doesn't prove it really works; maybe it steps on the rest of the system, maybe it does what it thinks it should do but not what the rest of the system thinks it should do, etc.
Are IntegrationTests usually automated? If so, how? More testing is not better testing.