Add SimplyStored::HasAttachment — Paperclip replacement for CouchDB
- New module lib/simply_stored/has_attachment.rb Drop-in replacement using MiniMagick for thumbnail generation. Same file paths as Paperclip — zero migration of existing files. Auto-declares CouchDB properties for attachment metadata. Proxy object mimics Paperclip::Attachment API for view compat. - Wired into lib/cmtool.rb - Added TODO migration comments to Image, News, Quote models
This commit is contained in:
@@ -2,6 +2,10 @@ module Cmtool
|
||||
class Image
|
||||
include SimplyStored::Couch
|
||||
include Paperclip::Glue
|
||||
# TODO: Replace Paperclip with SimplyStored::HasAttachment
|
||||
# 1. Change `include Paperclip::Glue` to `include SimplyStored::HasAttachment`
|
||||
# 2. Replace `has_attached_file :file, styles: {...}` with `has_attachment :file, styles: {...}`
|
||||
# 3. Replace `validates_attachment` with standard Rails validations
|
||||
|
||||
property :file_file_name
|
||||
property :file_content_type
|
||||
|
||||
@@ -2,6 +2,9 @@ module Cmtool
|
||||
class News
|
||||
include SimplyStored::Couch
|
||||
include Paperclip::Glue
|
||||
# TODO: Replace Paperclip with SimplyStored::HasAttachment
|
||||
# 1. Change `include Paperclip::Glue` to `include SimplyStored::HasAttachment`
|
||||
# 2. Replace `has_attached_file :image, styles: {...}` with `has_attachment :image, styles: {...}`
|
||||
|
||||
property :title
|
||||
property :active, type: :boolean, default: true
|
||||
|
||||
@@ -2,6 +2,9 @@ module Cmtool
|
||||
class Quote
|
||||
include SimplyStored::Couch
|
||||
include Paperclip::Glue
|
||||
# TODO: Replace Paperclip with SimplyStored::HasAttachment
|
||||
# 1. Change `include Paperclip::Glue` to `include SimplyStored::HasAttachment`
|
||||
# 2. Replace `has_attached_file :image, styles: {...}` with `has_attachment :image, styles: {...}`
|
||||
|
||||
property :owner
|
||||
property :function
|
||||
|
||||
Reference in New Issue
Block a user