= Papermill Asset management made easy.. Painfully easy. == Try the demo to get the idea: rails -m http://gist.github.com/177714.txt papermill-example == Papermill comes in 2 flavors: === Generic catch-all declaration papermill {my_option_hash} # in your papermilled assetable model assets_upload(:my_key, {optional_option_hash}) # form helper call @assetable.papermill_assets(:key => :my_key) # data access in your view === Association specific declaration papermill :my_association, {my_option_hash} # in your papermilled assetable model assets_upload(my_association, {optional_option_hash}) # form helper call @assetable.my_association # data access in your view In both case, you can specify a PapermillAsset subclass to use with :class_name => MyPapermillAssetSubclass in the option hash See papermill_module.rb for the complete list of options. == Installation === You'll need something like this in your environment.rb: config.gem 'rsl-stringex', :lib => 'stringex', :source => 'http://gems.github.com' config.gem 'paperclip' config.gem 'authlogic' config.gem 'mime-types', :lib => 'mime/types' config.gem 'ryanb-acts-as-list', :lib => 'acts_as_list', :source => 'http://gems.github.com' config.gem 'BBenezech-papermill', :lib => 'papermill', :source => 'http://gems.github.com' === Then you can the whole thing: $ sudo gem install ryanb-acts-as-list -s http://gems.github.com $ sudo gem install paperclip $ sudo rake gems:install # will install the others gem. # You need to install paperclip & acts_as_list first, because of a dependency mayhem. # Next version of gem will use gem dependencies $ ./script/generate papermill PapermillMigration # will generate a migration named PapermillMigration and copy a couple of static assets $ rake db:migrate === In your assetable model: # You can set a catch-all papermill association : papermill {:class_name => Asset} # or create an association for the specific :my_gallery key papermill :my_gallery, { :class_name => GalleryAsset, :thumbnail => { :width => 90, :height => 30 } } === In your layout: <%= papermill_stylesheet_tag %> <%= papermill_javascript_tag :with_jquery => "no_conflict" %> # you won't need :with_jquery if you use it already, obviously. === In your edit form: f.images_upload(:my_gallery) # use specific papermill :my_gallery declaration f.assets_upload(:my_assets) # use catch-all f.asset_upload(:my_other_asset) # use catch-all === Access them with: @assetable.my_gallery.each{ |image| image.url("100x100") } @assetable.papermill_assets(:key => :my_assets).each{ |asset| asset.url } @assetable.papermill_assets(:key => :my_other_asset).first.url Also see http://gist.github.com/177714.txt for more precises installation steps. Have a look at the API here http://rdoc.info/projects/BBenezech/papermill === Translations: Papermill is fully I18n-able. Copy config/locales/papermill.yml to your root config/locale folder to modify any wording in a any locale. == Word of caution: Beta. Wait for gem 1.0.0 for the production ready thing. This is xNIX only (system("rm ...")). Rails 2.3 Copyright (c) 2009 Benoit Bénézech, released under the MIT license