Skip to content

ShiningRay/upyun-paperclip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UpYun Storage engine for paperclip

This gem allows you to use UpYun Storage as storage engine for paperclip

Installation

gem install upyun-paperclip

Rails 3

Using paperclip's master branch since this issue is fixed in it.

gem "paperclip", :git => 'git://github.com/thoughtbot/paperclip.git'
gem "upyun-paperclip", :git => 'git://github.com/frankel/upyun-paperclip.git'

Usage

If you have a model named User, then you can set options like this.

One model

class User < ActiveRecord::Base  
  has_attached_file :avatar,
  { 
    :storage => :upyun, 

    # Please set these four options found in your upyun account.
    :upyun_bucketname => 'bucketname',
    :upyun_username => 'username',
    :upyun_password => 'password',
    :upyun_domain => 'domain',
    
    # Set any other options according to paperclip
    :styles => { :medium => "300x300>", :thumb => "100x100>" }
  }
end

Multiple models

If you have more than one model to use paperclip, and feel bored to set the same options for each one, you can create a file named paperclip.rb under config\initializers folder, and write code like this:

Paperclip::Storage::Upyun::Config = { 
  :upyun_bucketname => 'bucketname',
  :upyun_username => 'username',
  :upyun_password => 'password',
  :upyun_domain => 'domain'
}

and only set :storage => :upyun in each models.

About

Upyun storage engine for paperclip

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 96.4%
  • JavaScript 1.8%
  • CoffeeScript 1.8%