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
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Sat Jun 28 16:20:20 -0700 2008 | |
| |
README.textile | Sun Jun 29 06:27:14 -0700 2008 | |
| |
generators/ | Tue Mar 31 09:34:00 -0700 2009 | |
| |
init.rb | Sat Jun 28 16:20:20 -0700 2008 | |
| |
lib/ | Tue Apr 07 07:37:04 -0700 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








