Sha256: be563d64628b2c24134bc6d3428429d9b9cc690d3348725fcdc8f8dce6376310

Contents?: true

Size: 1.41 KB

Versions: 2

Compression:

Stored size: 1.41 KB

Contents

= Attached

Attached is a Ruby on Rails file attachment tool that lets users upload to the cloud, then process in the cloud. The tool supports Amazon S3 by default. It surpasses Paperclip by providing built-in support for direct uploads to the cloud and by allowing integration with cloud based processing tools. However, in almost every other way Paperclip is better. The source code inspired (and copied) from Paperclip. If you aren't working in the cloud exclusively then this isn't for you!

== Installation

  gem install attached
  
== Examples

Migration:

  class CreateVideo < ActiveRecord::Migration
    def self.up
      create_table :videos do |t|
        t.string :video_extension
        t.integer :video_size

        t.timestamps
      end
    end

    def self.down
      drop_table :videos
    end
  end

Model:
  
  has_attached :video, :styles => { 
    :mp4_720p => { :extension => 'mp4' },
    :mp4_480p => { :extension => 'mp4' },
    :ogv_720p => { :extension => 'ogv' },
    :ogv_480p => { :extension => 'ogv' },
  }
  
Form:

  <%= form_for @video, :html => { :multipart => true } do |form| %>
    <%= form.file_field :video %>
    <p class="errors"><%= @video.errors[:video] %></p>
  <% end %>
  
View:

  <video>
    <source src="<%= @video.video.url(:mp4_480p) %>" />
    <source src="<%= @video.video.url(:ogv_480p) %>" />
  </video>
  
== Copyright

Copyright (c) 2010 Kevin Sylvestre. See LICENSE for details.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
attached-0.0.2 README.rdoc
attached-0.0.1 README.rdoc