README.rdoc in attached-0.2.2 vs README.rdoc in attached-0.2.3

- old
+ new

@@ -1,8 +1,8 @@ = 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 is inspired (and copied) from Paperclip. If you aren't working in the cloud exclusively then this isn't for you! +Attached is a Ruby on Rails file attachment tool that lets users upload to the cloud, then process in the cloud. The gem supports AWS, Google and Rackspace for storage networks by default. It is influenced (and copied) from Paperclip. == Requirements The gem has only been tested with Ruby 1.9.2 and Rails 3.0.3 but may well work with other versions of Ruby and Rails. @@ -56,25 +56,50 @@ <source src="<%= @video.encoding.url(:ogg_480p) %>" /> </video> == Advanced -=== Storage +=== Validations + + # app/models/person.rb + validates_attached_presence :avatar + validates_attached_size :avatar, :in => 2.kilobytes..2.megabytes + +==== Storage - has_attached :avatar, :provider => :aws, :credentials => { - :secret_access_key => "*****", - :access_key_id => "*****", - } + # app/models/person.rb + has_attached :avatar, :medium => :aws, :credentials => "#{Rails.root}/config/aws.yml" + # app/models/person.rb + has_attached :avatar, :medium => :google, "#{Rails.root}/config/google.yml" + + # app/models/person.rb + has_attached :avatar, :medium => :rackspace, "#{Rails.root}/config/rackspace.yml" + + # config/initializers/attached.rb + Attached::Attachment.options[:medium] = :aws + Attached::Attachment.options[:credentials] = "#{Rails.root}/config/aws.yml" + + # config/initializers/attached.rb + Attached::Attachment.options[:medium] = :google + Attached::Attachment.options[:credentials] = "#{Rails.root}/config/google.yml" + + # config/initializers/attached.rb + Attached::Attachment.options[:medium] = :rackspace + Attached::Attachment.options[:credentials] = "#{Rails.root}/config/rackspace.yml" + === Processor + # app/models/person.rb has_attached :avatar, :processor => :image, :styles => { - :small => { :size => "200x200#" } - :large => { :size => "400x400#" } + :small => { :size => '200x200<', :extension => 'png' }, + :large => { :size => '400x400>', :extension => 'png' }, + :default => { :size => '300x300#' }, } -=== Alias +=== Aliases + # app/initializer/attached.rb Attached::Attachment.options[:aliases] = %w( d1kf5um3mxa8kv.cloudfront.net d3d5wf186mp1rv.cloudfront.net d2wmfkw6rydl1g.cloudfront.net d1gqpdc40l7s16.cloudfront.net