contained documents (i.e. attachments) for sequel models
Ruby
Latest commit 76b2265 Feb 6, 2009 S. Brent Faulkner support direct assignment of upload to contained item
- add assignment method
- store image width and height
Permalink
Failed to load latest commit information.
lib support direct assignment of upload to contained item Feb 6, 2009
test add tests to make content presence dependent on type instead of (poss… Jan 20, 2009
.gitignore first commit Jan 12, 2009
MIT-LICENSE whitespace correction Feb 4, 2009
README.markdown support direct assignment of upload to contained item Feb 6, 2009
Rakefile
sequel_container.gemspec support direct assignment of upload to contained item Feb 6, 2009

README.markdown

sequel_container

contained documents (i.e. attachments) for sequel models

WHY?

I needed a way to more easily support images and css in blobs, since the hosting provider I'm using is read-only (except for the tmp folder) and I'm not ready to use Amazon, or any other external storage provider.

Installation

Run the following if you haven't already:

$ gem sources -a http://gems.github.com

Install the gem(s):

$ sudo gem install -r sbfaulkner-sequel_container

Example

require 'rubygems'
require 'sequel'

class User < Sequel::Model
  set_schema do
    primary_key :id
    varchar :avatar_type, :size => 255
    bytea :avatar_data
  end
  is :container, :tmp => File.dirname(__FILE__) + '/tmp'
  contains :avatar, :url => '/images/avatars/:id.:extension'
end

CHANGES

1.2.0

  • added assignment method
  • automatically store image width and height for image content types

1.1.0

  • added support for :url option on contains to specify custom url path

TODO

  • support for assignment other than from rack/sinatra?
  • other containment types... e.g. filesystem, s3, git?

Legal

Author: S. Brent Faulkner brentf@unwwwired.net License: Copyright © 2009 unwwwired.net, released under the MIT license