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 Mar 31 09:34:00 -0700 2009
commit 101d8d6ac2c65f0810bec5ad453be79d5e279da3
tree a6ca20ad0317787d1b44e93267e1cf5b1e596c32
parent be0b0e62dd4c4a7506009be71a3c47e3a5899a22
tree a6ca20ad0317787d1b44e93267e1cf5b1e596c32
parent be0b0e62dd4c4a7506009be71a3c47e3a5899a22
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Sat Jun 28 16:20:20 -0700 2008 | |
| |
README.textile | Sun Jun 29 06:27:14 -0700 2008 | |
| |
generators/ | ||
| |
init.rb | Sat Jun 28 16:20:20 -0700 2008 | |
| |
lib/ | Fri Jan 30 15:04:11 -0800 2009 | |
| |
spec/ | Thu Nov 06 07:29:00 -0800 2008 |
README.textile
Copyright © 2008 PolymorphicPaperclip Mark Daggett, released under the MIT license
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









