This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Mark Daggett (author)
Tue Apr 07 07:37:04 -0700 2009
commit b83dd5b1ddc0957bb1681f5c4fc116b1c8e2d0b3
tree 7cfe1f64f24f160005009ccdc75b3f90a896a844
parent 101d8d6ac2c65f0810bec5ad453be79d5e279da3
tree 7cfe1f64f24f160005009ccdc75b3f90a896a844
parent 101d8d6ac2c65f0810bec5ad453be79d5e279da3
paperclippolymorph / README.textile
PaperclipPolymorph
This plugin allows users of the Paperclip plugin to easily share attached files between
multiple models. Essentially, polymorphic paperclip transparently saves the attached files
into a separate asset’s table and associates the the model to the asset through a polymorphic
attachings table.
The Paperclip Plugin must also be installed for PolyMorphicPaperclip to work.
Get paperclip here:
http://thoughtbot.com/projects/paperclip
Example
class PhotoEssay < ActiveRecord::Base acts_as_polymorphic_paperclip end
You can also add a counter_cache to your model if you wish.
class Essay < ActiveRecord::Base
acts_as_polymorphic_paperclip :counter_cache => true
end
essay.assets.attach(asset)
essay.assets.asset.detach -or- @essay.assets.detach(asset)
Helper methods
There is one helper method so far used to determine if the asset can be displayed in a browser
@essay.assets.first.browser_safe? # => returns true or false
Copyright © 2008 PolymorphicPaperclip Mark Daggett, released under the MIT license








