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:
BenClaw
2026-05-18 04:41:56 +02:00
parent 6f2193a5e5
commit 37cbb428c6
5 changed files with 241 additions and 0 deletions
+4
View File
@@ -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
+3
View File
@@ -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
+3
View File
@@ -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