mongoid_grid 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/mongoid/grid.rb +4 -4
  2. data/lib/rack/grid.rb +2 -2
  3. metadata +7 -7
data/lib/mongoid/grid.rb CHANGED
@@ -26,7 +26,7 @@ module Mongoid
26
26
  #
27
27
  # Only the _id is really needed, the others are helpful cached
28
28
  # so you don't need to hit GridFS
29
- field "#{name}_id".to_sym, :type => BSON::ObjectID
29
+ field "#{name}_id".to_sym, :type => BSON::ObjectId
30
30
  field "#{name}_name".to_sym, :type => String
31
31
  field "#{name}_size".to_sym, :type => Integer
32
32
  field "#{name}_type".to_sym, :type => String
@@ -107,7 +107,7 @@ module Mongoid
107
107
  file.original_filename : File.basename(file.path)
108
108
  type = MIME::Types.type_for(filename).first
109
109
  mime = type ? type.content_type : "application/octet-stream"
110
- send("#{name}_id=", BSON::ObjectID.new)
110
+ send("#{name}_id=", BSON::ObjectId.new)
111
111
  send("#{name}_name=", filename)
112
112
  send("#{name}_size=", File.size(file))
113
113
  send("#{name}_type=", mime)
@@ -130,7 +130,7 @@ module Mongoid
130
130
  ##
131
131
  # Attachments we need to remove after save
132
132
  def delete_attachment(name,id)
133
- delete_attachment_queue[name] = id if id.is_a?(BSON::ObjectID)
133
+ delete_attachment_queue[name] = id if id.is_a?(BSON::ObjectId)
134
134
  send("#{name}_id=", nil)
135
135
  send("#{name}_name=", nil)
136
136
  send("#{name}_size=", nil)
@@ -140,7 +140,7 @@ module Mongoid
140
140
  ##
141
141
  # Delete an attachment from GridFS
142
142
  def delete_grid_attachment(name,id)
143
- grid.delete(id) if id.is_a?(BSON::ObjectID)
143
+ grid.delete(id) if id.is_a?(BSON::ObjectId)
144
144
  delete_attachment_queue.delete(name)
145
145
  end
146
146
 
data/lib/rack/grid.rb CHANGED
@@ -51,7 +51,7 @@ module Rack
51
51
  ##
52
52
  # Get file from GridFS or return a 404
53
53
  def grid_request(id)
54
- file = Mongo::Grid.new(db).get(BSON::ObjectID.from_string(id))
54
+ file = Mongo::Grid.new(db).get(BSON::ObjectId.from_string(id))
55
55
 
56
56
  etag, last_modified = file.instance_variable_get(:@md5), Time.at( file.upload_date.to_i )
57
57
  headers = {
@@ -64,7 +64,7 @@ module Rack
64
64
  else
65
65
  [200, headers.update('Content-Type' => file.content_type), [file.read]]
66
66
  end
67
- rescue Mongo::GridError, BSON::InvalidObjectID
67
+ rescue Mongo::GridError, BSON::InvalidObjectId
68
68
  [404, {'Content-Type' => 'text/plain'}, ['File not found.']]
69
69
  end
70
70
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_grid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dusty Doris
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-13 00:00:00 -04:00
18
+ date: 2010-10-03 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -40,14 +40,14 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- hash: 62196417
43
+ hash: 62196421
44
44
  segments:
45
45
  - 2
46
46
  - 0
47
47
  - 0
48
48
  - beta
49
- - 17
50
- version: 2.0.0.beta.17
49
+ - 19
50
+ version: 2.0.0.beta.19
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  description: Plugin for Mongoid to use GridFS and a Rack helper