README.md in tori-0.3.0 vs README.md in tori-0.4.0
- old
+ new
@@ -113,20 +113,29 @@
photo.striped_image.write
}
end
```
-
# Custom configure example
```ruby
# Save to S3 bucket.
require 'tori/backend/s3'
Tori.config.backend = Tori::Backend::S3.new(bucket: 'tori_bucket')
# Filename decided by model.class.name,id and hidden words.
Tori.config.filename_callback do |model|
"#{model.class.name}/#{Digest::SHA1.hexdigest "#{ENV["TORI_MAGICKWORD"]}/#{model.id}"}"
+end
+
+# You can change any way define filename.
+Tori.config.filename_callback do |model|
+ # `__tori__` method is meta name of defined by `tori` method.
+ "#{model.class.name}/#{__tori__}/#{model.title}"
+ # class Photo
+ # tori :orig #=> "Photo/orig/cool-shot.png"
+ # tori :strip #=> "Photo/strip/cool-shot.png"
+ # end
end
```
# Default configure