couch_photo 1.0.0.beta.4 → 1.0.0.beta.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/couch_photo/couch_photo.rb +8 -0
  3. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.beta.4
1
+ 1.0.0.beta.5
@@ -4,6 +4,7 @@ module CouchPhoto
4
4
  base.property :variation_metadata, Hash, :default => {}
5
5
  base.extend ClassMethods
6
6
  base.before_create :generate_variations
7
+ base.after_create :decode_attachments
7
8
  end
8
9
 
9
10
  module ClassMethods
@@ -114,4 +115,11 @@ module CouchPhoto
114
115
  variation_definition.generate_variation self
115
116
  end
116
117
  end
118
+
119
+ # why is this necessary? Because couchrest destructively base64 encodes all attachments in your document.
120
+ def decode_attachments
121
+ self["_attachments"].each do |attachment_id, attachment_properties|
122
+ self["_attachments"][attachment_id]["data"] = Base64.decode64 attachment_properties["data"] if attachment_properties["data"]
123
+ end if self["_attachments"]
124
+ end
117
125
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_photo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196363
4
+ hash: 62196361
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
10
  - beta
11
- - 4
12
- version: 1.0.0.beta.4
11
+ - 5
12
+ version: 1.0.0.beta.5
13
13
  platform: ruby
14
14
  authors:
15
15
  - Matt Parker