Releases: obie/after_attached
Releases · obie/after_attached
v0.1.1 - Fix GitHub URLs
🔧 Patch Release
This patch release corrects the GitHub repository URLs in the gemspec and documentation.
Fixed
- Updated all GitHub URLs from to
- Corrected links in README and gemspec
Installation
gem 'after_attached', '~> 0.1.1'No functional changes in this release - all the same great attachment lifecycle callbacks from v0.1.0!
v0.1.0 - Initial Release
🎉 Initial Release
AfterAttached provides comprehensive attachment lifecycle callbacks for Rails models with Active Storage attachments.
Features
-
Complete lifecycle callbacks:
before_attached- runs before an attachment is savedafter_attached- runs after an attachment is committed to the databasebefore_detached- runs before an attachment is destroyedafter_detached- runs after an attachment is destroyed and committed
-
Flexible callback definition:
- Use method symbols or blocks
- Define multiple callbacks per attachment
- Works with both
has_one_attachedandhas_many_attached
-
Automatic integration:
- Automatically included in all Active Record models
- No configuration required
Installation
Add to your Gemfile:
gem 'after_attached', '~> 0.1.0'Example Usage
class User < ApplicationRecord
has_one_attached :avatar
after_attached :avatar do |attachment|
AvatarProcessingJob.perform_later(self, attachment)
end
before_detached :avatar do |attachment|
Rails.logger.info "Removing avatar: #{attachment.filename}"
end
endSee the README for full documentation.