RoR Resume Uploader App Gitter


This example will guide you through the code to build a simple Ruby on Rails App that works with a Minio Server. We will learn how to use the aws-sdk in our rails app to upload objects to a Minio Server. Full code is available here :, released under Apache 2.0 License.

1. Prerequisites

2. Dependencies

3. Install

Get the code from here and do a bundle install as shown below.

git clone
cd ror-resumeuploader-app
bundle install

Apart from all the standard gems to make a rails application, add the aws-sdk v2 gem to our Gemfile.

source ''

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more:
gem 'turbolinks'
# Build JSON APIs with ease. Read more:
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more:
  gem 'spring'
# Add the aws sdk gem
gem 'aws-sdk', '~> 2'

Note: If running this example on Ubuntu, please include therubyracer gem.

4. Set Up Bucket

We've created a public minio server called for developers to use as a sandbox. Minio Client mc is preconfigured to use the play server. Create a bucket called resumes on Use the mc mb command to accomplish this.

mc mb play/resumes

5. Configure AWS SDK with keys to Minio Server

Add an initializer file called aws.rb and set the credentials for Minio Server as shown below. In this example we use Minio's public server This may be replaced by your own instance of a running Minio Server in your own deployments.

  region: 'us-east-1',
  endpoint: "",
  force_path_style: true,

Note - Add the sslEnabled: false if the endpoint uses http instead of https.

6. Upload Objects

Since Minio Server is an AWS compatible server, it works seamlessly with the aws-sdk.

class UploadsController < ApplicationController
  require 'aws-sdk'
  def new

  def create   
    # Create a new s3 resource with a new s3 client.
    s3 =  

    # Create a key.
    key = File.basename params[:file].path

    # Set the bucket and the key.
    obj = s3.bucket("resumes").object(params[:file].original_filename)

    # Upload the file.

    # Save the uploaded details to the local database.
    @upload =
            url: obj.public_url,
            name: obj.key

        redirect_to uploads_path, success: 'File successfully uploaded'
    else[:notice] = 'There was an error'
        render :new

  def index
    @uploads = Upload.all


NOTE: In this particular example, we complete the upload process using the upload_file api call available via the aws-sdk library. If we want to process the upload on the view, we would post the file to a presigned URL that is able to accept our POST submission.

7. Create Views

We create a form which can do a multipart upload. We will use a file_field_tag to choose the file from the filesystem and a submit tag to submit the form to the upload controller for processing.

<div class="col-offset-lg-2 col-lg-12">
            <h1>Upload your Resume</h1>

            <div class="well"  style="background-color: #EFE0D5;">
                <%= form_tag uploads_path,  :html => {:multipart => true}, enctype: 'multipart/form-data' do %>
                <%= file_field_tag :file  %>  <br/>

                <%= submit_tag 'Upload file' , :class=>"btn btn-block btn-danger"  %>
              <% end %>

8. Run The App

The full code is available here : Start the rails server as shown below.

rake db:migrate
rails s

Now if you visit http://localhost:3000 you should be able to see the example application.

9. Explore Further