paperclip just worked
Posted in rails, GEM/plugins on November 21st, 2008OK for a current project I needed to have attached photos for stores. I could have chosen to use attachment_fu, but after seeing the excellent Railscast, I was eager to try paperclip. My opinion - a bit disappointing really, as it was so effortless I didn’t actually learn much at all. No looking through lots of plugin code, no spending hours of googling - no pain!
I grabbed the plugin code since the GEM seems to be out of date? How easy was it? Keep reading.
First I installed the plugin then I ran the migration. Four columns added to my stores table for filename, size, type and timestamp. Frankly I could live without all four, but some projects are gonna use these I suppose.
Next I added a line to the model to which I wanted to have an attachment:
I could have also specified multiple different file sizes to save, like 150×200, 400×300, etc.like this:
Then I added a couple lines to validate the things I cared about:
validates_attachment_content_type :exterior,
There’s one “gotcha” in here, in that to change your new and edit forms to work with binary attachments you’re gonna have to change the form action to be mixed/multipart
Next I went to the view and just refer to the attachment as @store.exterior.url (my stores controller serves up @store), and if I had saved thumbnails and large versions I could have specified which one I wanted to display.
Now I am saving these store images in a shared directory. So when I deploy, I have a task defined in capistrano that runs right after the deploy:symlink that also puts symlink in the public/images/stores directory pointing to this shared store photo store (pun intended) But I need to run a background task to back up those images periodically, or I’ll forget about them until one day…..
Long story short, I decided to see how easy it was to tell Paperclip to save them in my Amazon s3 account instead of the filesystem. Yeah you guess it - pretty tame. Here’s the revised store.rb snippet:
Don’t ask why I am using such a ridiculously named bucket, but I am. Anyway the 2 keys for s3 are kept in a YAML file as you can see. I treat it just like my database.yml file, and don’t version it, but simply keep in :rails_root/shared/config/ and create a symlink to it on every deploy.
Now you may ask, how can this be such a happy plugin experience. Well if I have to criticize, it would be that I see it added 4 columns to my stores table. In my case I could get by with less. But I think the main point is if I had a half dozen attachments per model, like for a real estate app with exteriors, kitchens, family rooms, etc. then this table could not be allowed to grow that wide.
But hey, if the app is featuring photos as a central item, shouldn’t you have a model just for your attachments? Add one column to refer back to the model it belongs_to and you’re golden. That’s really not so terrible.Valium Online
Discount Phentermine Phentermine Purchase Phentermine Adipex
Vardenafil Prescription Drug
Indian Sildenafil Citrate Softabs
Buy Phentermine Online Order Phentermine Now
Tramadol Experience
Buy Xanax Online Now
Buy Valium Online 32
Treating Depression Diet Phentermine Pill
Purchase Phentermine Looking For Phentermine
Tramadol What It Looks Like
Buy Cod Money Order Pay Xanax
Buy Fioricet Cheap Fioricet Keyword Fioricet
Viagra Cheapest Prices
Does Fioricet Contain Asprin
Viagra From Indiana Pharmacy
Tramadol And Ibupropen
Buy No Phentermine Prescri Ption
Generic Viagra Canada
37.5 Mg Phentermine With No Rx
Buy Xanax Cash On Delivery
Viagra Doctor Free
Fioricet Headaches Pregnancy
Phentermine Online No Script
Soma Carisoprodol Meprogesic
Online Usa Pharmacy Phentermine 90 Count
Buy Online Online Viagra Viagra
Viagra Cialis London Kamagra
Tramadol Orders Cod Delivery Companies
Tramadol Saturday
Mobile Office Buy Tramadol
Valium Generic Indian
Wellbutrin And Xanax
Buy Phentermine At Online Pharmacy Meds
Phentermine Diet Pills Di
Cheap Phentermine Worldwide Delivery
Pfizer Viagra And Its Cautions
Good Site To Buy Phentermine
Cheap Tramadol Very
Tramadol Wellbutrin Retin-a Cheap Ultram
Medication Called Tramadol
High Blood Pressure And Tramadol
Tramadol Hydrochloride Baikal Shop
Buy Phentermine Online Phentermine
Health Article Phentermine Diet Pill
Contact1 Tramadol
Viagra Alternative Review
Indication Tramadol
Sildenafil Citrate Mechanism
Effexor Interaction Wth Valium
Tramadol And Hydrocodone Mixing
Viagra Use For Women
Purchase Online Phentermine No Prescription
Healthy Living Phentermine Diet Pill
Online Name Brand Viagra
No Prescription Fed Ex Phentermine
Phentermine $70 No Prescription
Cash Delivery Tramadol
Vardenafil No Prescription
Pharmacy Comparison For Phentermine
Buy Discount Phentermine No Prescription
Discreet Online Phentermine
Fioricet Without Prescrip
Order Viagra Onlines
Buy Cheap Phentermine Moreover Order Viagra
Phentermine Pharmacy Cheap Phentermine
Cash On Delivery Tramadol Buy Online
Cheap Viagra Online A Href
Cialis Viagra Levitra Effects
Tobacco Edinburgh Search Thought Viagra Pages
Is Tramadol Legal Status
Pain Relief Tramadol
30mg Phentermine Online No Script
Viagra Constituents Uk
Buy Meridia
Order Viagra With Mastercard
Pharmacy Tadalafil
Find Phentermine Online
Phentermine Cod Pharmacy Online
Phentermine U S Online Physician
3.94 Diet Phentermine Pill
Generic Paxil Shape Pills Zydus
Generic Viagra Levitra And Tadalafil
Buy Valium Federal Express
Buy Viagra Ups
Tramadol Discount Codes
Discount Phentermine No Prescription Free Shipping
Phentermine Generic 90 Pills Overnight
Get Viagra Without A Prescription
Generic Viagra Solf Tabs
Order Valium Order
Drug Store Cost For Tramadol
99 Viagra Free Consultations Now
Tramadol Dosage For Cats
Tramadol Addiction
Online Pharmacy No Prescription Required Phentermine
Medlineplus Drug Information Tramadol
Cheap Clonapine Valium
Cheap Retin Ultram
Take Cialis And Viagra Together
Buy Tadalafil Medication Online
Viagra Order
Cheap Domain Phentermine P4p Nsk Ru
Australia Generic In Levitra Sales
Tramadol For Opiate Withdrawl
5 Money Order Sildenafil Citrate
Tramadol Saturday Fedex Shipping
Cyclobenzaprine Hci Pharmacy Online
Cheap Phentermine Mg
Viagra Online Kaufen
Free Viagra Sample Packs
Online Phentermine Without Perscription Fedex
Buy Phentermine Illegally Online Now
Viagra For Sales
Fioricet Contraindications
Canadian Propecia Cheap
Tramadol Purchase
Generic Viagra Drugstore India
Buy Online Pharmacy Viagra
Dosage Of Tramadol For Dogs
Tramadol $85
Generic Ultram Cod
Cheap Flonase Fosamax Myacalcin And Celebrex
Generic Name For Paxil Cr
Tramadol Genetic
Tramadol For Pet
Purchase Flexeril Online
Viagra Dicount
Tramadol Dog Pain
Online Parm Viagra
Order Ultram On Line
Fioricet Discontinuation Symptoms
Free Pack Sample Viagra
5 Overnight Generic Sildenafil Citrate
Cheap Phentermine 37.5mg
Fioricet Information
Carisoprodol Tramadol
Buy Phentermine Online No Prior Rx
Hydrocodone Mexican Pharmacy Phentermine Online
Fioricet In Urine Drug Screens
Buy Dreampharmaceuticals Levitra Online
Buy Phentermine In Florida
Pharmacy Degree Phentermine Diet Pill
Viagra For Women 2005
Tramadol Taper
Viagra Round Brown Pill
Buy Online Sale Viagra Viagra
Fatal Tramadol Dosage In Rats
Tramadol Overdose Resumption
Buy Xanax Online Us Pharmacy
What Is In Tramadol
Make Your Own Sildenafil Citrate Formula
6buy Generic Levitra
Tramadol And Metacam
Drug Test Narcotics Half Life Tramadol
Phentermine 37.5 90 No Prescription
Find Buy Valium At Ebay
What Does Phentermine Pill Look Like
Aan Agcode Buy Online Tramadol
Tramadol Side Effects Canines
Tramadol 50 Mg Tramadol
Best Offer Diet Pill Phentermine Viagra
Buy Xanax Without A Rx
Atipex Phentermine No Prescription
Local Pharmacy Name Brand Fioricet
Discount Pharmacy Purchase Ultram
Purchase Sildenafil Citrate Caducidad
Tramadol More Addicting Than Vicodin
Sildenafil Citrate For Woman
Claritin Perscription Drugs Tramadol
Tramadol Treatment
Tramadol Hcl 50 Gm
Price Search Tramadol
Phentermine Where To Buy
Ordering Tramadol And Shipping To Florida
Buy Hydrocodone And Xanax Now
Order Phentermine With Online Diagnosis
Buy Injectable Valium
Phentermine $99 No Prescription
Tramadol Home
Phentermine Phentermine Online Pharmacy Free Phentermine
Tramadol Withdrawal Inur
Phentermine Hci No Prescription Us Pharmacy
Buy Phentermine With A Mastercard
Ultram Order Prescription Tramadol Mg Tablets
Want To Buy Phentermine Online
Sildenafil Citrate Lithium
Phentermine Prescription
Tramadol Ultram
Can Viagra Help With Sexual Anxiety
Generic Xanax Best Prices
Tramadol Dosage Calculations For Dogs
Phentermine Us Online Md
Online Viagra With Insurance
What Does Generic Soma Look Like
Buy Phentermine To Loose
Phentermine Order
Cialis Generic Levitra Propecia Viagra
Buy Tadalafil Prescription Online
Dosage For Tramadol 377
Buy Viagra Online U
Viagra Generic Viagra Free Overnite Shipping
Phentermine Tablets 37.5
Fioricet Migraines Imitrex
What Can You Do To Tramadol
37.5 Card Master Phentermine
Tramadol And Food Poisoning
Buy Viagra Without A Perscription
College Ma Pharmacy Cheap Tramadol
Weight Loss On Effexor
Description Fioricet
Phentermine Diet Pill Shipped To Kentucky
Discount No Prescription Phentermine
Long Term Effects Taking Altram Tramadol
Drugstore Phentermine Online
What Is Tramadol Made Of
Viagra Find Sites Free
700 Million Classaction Lawsuit Against Viagra
Cardinal Health Tramadol On Line
Discount From Prescription Price Rx Soma
Order Xanax On Br
Cheap Tramadol 300ct 50mg No Prescripion
Href Online Phentermine
Vardenafil Without Prescription
Tramadol Amp Ultram Tramadol
Viagra Canadaian Prices
Tramadol For Pe
Buy Phentermine Online U S Pharmacy
Phentermine 37.5 90 Day
Pet Meds Tramadol
Fioricet Images
India Viagra Generic
Phentermine Canada Online
Phentermine Doctor Prescription Address Phone
1cialis Compare Levitra Viagra
Buy Hydrocodone Online Consult
Generic Viagra Suppliers
Buy Viagra Xanax
Drug Screening Tramadol
Online Pharmacy Didrex
Cheap Cod Fioricet
Esa Soma Business Software
Dose Order Single Viagra
Bay Tramadol
Buy In Online Uk Viagra
Order Hydrocodone Online Legally
Fioricet Information Weight Loss Pill
Buying Viagra Without Prescription
Tramadol And Dea
Valium No Prescription Next Day
Lose Weight Phentermine Cod Orders
Online Search Tramadol
West Coast Tramadol
Pain Medication Tramadol
Office Pill Phentermine
Phentermine
No Prescription Vardenafil Hydrochloride
Online Tramadol Purchase
Drug Fioricet
Tramadol Addictio
Buy Online Flomax
Hydrocodone And Ambien
Free Viagra Woman
Tramadol 180 Cod
Pharmacy Diflucan Online
Ultram Online From Dreampharmaceuticals
Buy Tramadol Online Now
Viagra Prescription Order
Buy Online Us Viagra
Soma Drugs
Sildenafil Citrate And Tinnitus
Hydocan Tramadol
Buy Online Pharmacy Soma
Purchase Phentermine 37.5 Mg
Generic Tramadol Online
Phentermine To Buy No Prescription
Discount Phentermine Get It Cheapest Phentermine
Comparison Between Vardenafil Cialis And Viagra
Tramadol Cats Dose
Tramadol P111
Buy Meridia Reductil
Viagra For Sale In Australia
Effect Of Viagra On Female
Discount Viagra Without Perscription
Side Effects Of Ultram Tizanidine Evil
Viagra Cheap Mexico
Aciphex Phentermine Pharmacy Washington Dc
Tramadol Overnight Shipping
Buy Meridia Online Dream Pharmaceutical
C One R Tamoxifen Website
Phentermine Where To Buy 3 99
Is Valium Diazepam Safe For Dogs
Money Order Tramadol
Buy Tramadol Online No Prescription
Fioricet No Online Prescription
Soma Drug Testing
Soma Pharmacy Buy Soma Online Pharmacy
Vicodin Detox Medication
Sample Generic Viagra
Tramadol Cod 120


