glebtv-rails-uploader 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +46 -6
  3. data/app/assets/javascripts/uploader/application.js +0 -0
  4. data/app/assets/stylesheets/uploader/default.css +0 -0
  5. data/app/controllers/uploader/attachments_controller.rb +0 -0
  6. data/app/views/uploader/default/_container.html.erb +0 -0
  7. data/app/views/uploader/default/_download.html.erb +0 -0
  8. data/app/views/uploader/default/_sortable.html.erb +24 -0
  9. data/config/locales/en.yml +1 -0
  10. data/config/routes.rb +0 -0
  11. data/lib/file_size_validator.rb +2 -0
  12. data/lib/uploader.rb +8 -3
  13. data/lib/uploader/asset.rb +5 -1
  14. data/lib/uploader/fileuploads.rb +7 -13
  15. data/lib/uploader/helpers/field_tag.rb +0 -0
  16. data/lib/uploader/hooks/formtastic.rb +0 -0
  17. data/lib/uploader/hooks/simple_form.rb +0 -0
  18. data/lib/uploader/version.rb +1 -1
  19. data/spec/dummy/app/models/article.rb +7 -3
  20. data/spec/dummy/app/models/asset.rb +19 -26
  21. data/spec/dummy/app/models/picture.rb +4 -4
  22. data/spec/dummy/config/application.rb +7 -5
  23. data/spec/dummy/config/environments/development.rb +5 -1
  24. data/spec/dummy/config/environments/production.rb +4 -0
  25. data/spec/dummy/config/environments/test.rb +6 -2
  26. data/spec/dummy/config/mongoid.yml +12 -0
  27. data/spec/dummy/log/test.log +134 -0
  28. data/spec/dummy/public/uploads/picture/data/5260e2af61732e16d5010000/rails.png +0 -0
  29. data/spec/dummy/public/uploads/picture/data/5260e2af61732e16d5010000/thumb_rails.png +0 -0
  30. data/spec/dummy/public/uploads/picture/data/5260e2af61732e16d5060000/rails.png +0 -0
  31. data/spec/dummy/public/uploads/picture/data/5260e2af61732e16d5060000/thumb_rails.png +0 -0
  32. data/spec/dummy/public/uploads/picture/data/5260e2e261732e1735010000/rails.png +0 -0
  33. data/spec/dummy/public/uploads/picture/data/5260e2e261732e1735010000/thumb_rails.png +0 -0
  34. data/spec/dummy/public/uploads/picture/data/5260e2e261732e1735060000/rails.png +0 -0
  35. data/spec/dummy/public/uploads/picture/data/5260e2e261732e1735060000/thumb_rails.png +0 -0
  36. data/spec/factories/assets.rb +0 -1
  37. data/spec/fileuploads_spec.rb +2 -2
  38. data/spec/mongoid.yml +17 -0
  39. data/spec/mongoid_spec.rb +42 -0
  40. data/spec/requests/attachments_controller_spec.rb +1 -1
  41. data/spec/spec_helper.rb +4 -1
  42. data/vendor/assets/javascripts/uploader/jquery.fileupload-fp.js +223 -0
  43. data/vendor/assets/javascripts/uploader/jquery.ui.widget.js +530 -0
  44. metadata +42 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e79bc5b85eca7ab9c8fed7585c566aeddec72d4
4
- data.tar.gz: 3cfd33ff72b4095731336ad99ed1b7c32b27d010
3
+ metadata.gz: b719ad42b85a63667d02cf89447b07faeb5f8616
4
+ data.tar.gz: 3464e6e069fc677464fd781eccdbee1fb611eb3b
5
5
  SHA512:
6
- metadata.gz: 4ce5c29e0e93c3374102d220436c4fb6a291b2f46d9b99dd59092bea35b8b46bc876d6e057c8e374d652dfde84cd791be5bc6ff31cea9e3db0feafe5d027bccd
7
- data.tar.gz: d9b1ca0dea6ef34755a979fd533c9fc0e4d16f978559e814e8383b6adc69d4b0cdd0ca4902e7574f82a8be5a34f2e9fb1c63b920dd20941982f142fb14a22115
6
+ metadata.gz: f762c7d1924fbfe7d955e31a5d1d2f8ecb83ef495cf96dbf30b5bdfe892216fc4a71d9b50648765e867b7e36ceb23f6eb0208f26e8942abcb63d2bd2560d81ea
7
+ data.tar.gz: 28a019429944301094d78257ccbf27f31472673215240f28d726fd14cf1c04a1c6a63b3e075522156e9c2cacb60786981f19562145c64eb60f83ae86d34947e2
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- ## this fork adds mongoid and rails_admin support
1
+ ## this fork adds mongoid and rails_admin support.
2
+ ## ActiveRecord support is dropped!
2
3
 
3
4
  This fork works when both simple form and formtastic are loaded
4
5
 
@@ -40,8 +41,11 @@ mount Uploader::Engine => '/uploader'
40
41
 
41
42
  # this workaround is sometimes needed so IDs are ObjectIDs not strings
42
43
  before_save do
43
- if !assetable_id.blank? && assetable_id.class.name != "Moped::BSON::ObjectId" && Moped::BSON::ObjectId.legal?(assetable_id)
44
- self.assetable_id = Moped::BSON::ObjectId.from_string(assetable_id)
44
+ return true if self.assetable_id.nil? || !self.assetable_id.is_a?(String)
45
+ if defined?(Moped::BSON)
46
+ self.assetable_id = Moped::BSON::ObjectId.from_string(self.assetable_id) if Moped::BSON::ObjectId.legal?(self.assetable_id)
47
+ else
48
+ self.assetable_id = BSON::ObjectId.from_string(self.assetable_id) if BSON::ObjectId.legal?(self.assetable_id)
45
49
  end
46
50
  true
47
51
  end
@@ -200,6 +204,32 @@ Find asset by foreign key or guid:
200
204
  @user.fileupload_asset(:picture)
201
205
  ```
202
206
 
207
+ ### Mongoid
208
+
209
+ ``` ruby
210
+ class Asset
211
+ include Mongoid::Document
212
+ include Uploader::Asset::Mongoid
213
+
214
+ belongs_to :assetable, polymorphic: true
215
+ end
216
+
217
+ class Picture < Asset
218
+ mount_uploader :data, ImageUploader
219
+
220
+ default_scope asc( :sort_order )
221
+ end
222
+
223
+ class User
224
+ include Mongoid::Document
225
+ include Uploader::Fileuploads::Mongoid
226
+
227
+ has_many :pictures, :as => :assetable
228
+
229
+ fileuploads :pictures
230
+ end
231
+ ```
232
+
203
233
  ### Include assets
204
234
 
205
235
  Javascripts:
@@ -224,19 +254,29 @@ Stylesheets:
224
254
  or FormBuilder:
225
255
 
226
256
  ``` ruby
227
- <%= form.uploader_field :photo %>
257
+ <%= form.uploader_field :photo, :sortable => true %>
228
258
  ```
229
259
 
230
260
  ### Formtastic
231
261
 
232
262
  ``` ruby
233
- <%= f.input :picture, :as => :uploader %>
263
+ <%= f.input :pictures, :as => :uploader %>
234
264
  ```
235
265
 
236
266
  ### SimpleForm
237
267
 
238
268
  ``` ruby
239
- <%= f.input :picture, :as => :uploader %>
269
+ <%= f.input :pictures, :as => :uploader, :input_html => {:sortable => true} %>
270
+ ```
271
+
272
+ #### Confirming deletions
273
+
274
+ This is only working in Formtastic and FormBuilder:
275
+
276
+ ``` ruby
277
+ # formtastic
278
+ <%= f.input :picture, :as => :uploader, :confirm_delete => true %>
279
+ # the i18n lookup key would be en.formtastic.delete_confirmations.picture
240
280
  ```
241
281
 
242
282
  ## Contributing
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,24 @@
1
+ <script type="text/javascript">
2
+ $(function() {
3
+ var container, data;
4
+
5
+ container = $("#<%= field.id %> div.uploader-files");
6
+
7
+ container.sortable({
8
+ placeholder: "attach_item",
9
+ cursor: "move",
10
+ update: function(event, ui) {
11
+ data = $(this).sortable("serialize", {key: "assets[]"});
12
+
13
+ $.rails.ajax({
14
+ url: "<%= uploader.attachment_path(field.klass) %>",
15
+ type: "PUT",
16
+ dataType: "json",
17
+ data: data + "&klass=<%= field.klass %>"
18
+ });
19
+ }
20
+ });
21
+
22
+ container.disableSelection();
23
+ });
24
+ </script>
@@ -3,3 +3,4 @@ en:
3
3
  button: "Choose file"
4
4
  drop: "Drag&Drop files here"
5
5
  or: "or"
6
+ confirm_delete: "Are you sure?"
data/config/routes.rb CHANGED
File without changes
@@ -1,6 +1,8 @@
1
1
  # file_size_validator.rb
2
2
  # Based on: https://gist.github.com/795665
3
3
 
4
+ require 'singleton'
5
+
4
6
  class FileSizeValidator < ActiveModel::EachValidator
5
7
  MESSAGES = { :is => :wrong_size, :minimum => :size_too_small, :maximum => :size_too_big }.freeze
6
8
  CHECKS = { :is => :==, :minimum => :>=, :maximum => :<= }.freeze
data/lib/uploader.rb CHANGED
@@ -10,7 +10,7 @@ module Uploader
10
10
  autoload :FormBuilder, 'uploader/helpers/form_builder'
11
11
  autoload :FieldTag, 'uploader/helpers/field_tag'
12
12
  end
13
-
13
+
14
14
  def self.guid
15
15
  SecureRandom.base64(15).tr('+/=', 'xyz').slice(0, 10)
16
16
  end
@@ -21,11 +21,16 @@ module Uploader
21
21
 
22
22
  def self.assets
23
23
  ['uploader/application.css', 'uploader/application.js', 'uploader/rails_admin.js'] +
24
- Dir[root_path.join('vendor/assets/javascripts/uploader/**', '*.{js,css}')].inject([]) do |list, path|
25
- list << Pathname.new(path).relative_path_from(root_path.join('vendor/assets/javascripts')).to_s
24
+ Dir[root_path.join('app/assets/javascripts/uploader/**', '*.{js,css}')].inject([]) do |list, path|
25
+ list << Pathname.new(path).relative_path_from(root_path.join('app/assets/javascripts')).to_s
26
26
  list
27
27
  end
28
28
  end
29
+
30
+ def self.constantize(klass)
31
+ return if klass.blank?
32
+ klass.safe_constantize
33
+ end
29
34
  end
30
35
 
31
36
  require 'uploader/engine'
@@ -16,7 +16,11 @@ module Uploader
16
16
  self.guid = params[:guid]
17
17
  self.assetable_type = params[:assetable_type]
18
18
  if self.class.respond_to?(:collection) && !params[:assetable_id].blank?
19
- self.assetable_id = Moped::BSON::ObjectId.from_string(params[:assetable_id])
19
+ if defined?( Moped::BSON )
20
+ self.assetable_id = Moped::BSON::ObjectId.from_string(params[:assetable_id])
21
+ else
22
+ self.assetable_id = BSON::ObjectId.from_string(params[:assetable_id])
23
+ end
20
24
  else
21
25
  self.assetable_id = params[:assetable_id]
22
26
  end
@@ -5,16 +5,7 @@ module Uploader
5
5
  end
6
6
 
7
7
  module SingletonMethods
8
- # Join ActiveRecord object with uploaded file
9
- # Usage:
10
- #
11
- # class Article < ActiveRecord::Base
12
- # has_one :picture, :as => :assetable, :dependent => :destroy
13
- #
14
- # fileuploads :picture
15
- # end
16
- #
17
- #
8
+ # Join Mongoid object with uploaded file
18
9
  def fileuploads(*args)
19
10
  options = args.extract_options!
20
11
 
@@ -39,15 +30,18 @@ module Uploader
39
30
  # Update reflection klass by guid
40
31
  def fileupload_update(record_id, guid, method)
41
32
  query = fileupload_klass(method).where(:guid => guid, :assetable_type => base_class.name.to_s)
42
- record_id = Moped::BSON::ObjectId.from_string(record_id) unless record_id.class.name == "Moped::BSON::ObjectId"
43
- p record_id
33
+ if defined?( Moped::BSON )
34
+ record_id = Moped::BSON::ObjectId.from_string(record_id) unless record_id.class.name == "Moped::BSON::ObjectId"
35
+ else
36
+ record_id = BSON::ObjectId.from_string(record_id) unless record_id.class.name == "BSON::ObjectId"
37
+ end
44
38
  query.update_all(:assetable_id => record_id, :guid => nil)
45
39
  end
46
40
 
47
41
  # Find asset by guid
48
42
  def fileupload_find(method, guid)
49
43
  klass = fileupload_klass(method)
50
- klass.where(:guid => guid)
44
+ klass.where(:guid => guid).first
51
45
  end
52
46
 
53
47
  # Find class by reflection
File without changes
File without changes
File without changes
@@ -1,3 +1,3 @@
1
1
  module Uploader
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
@@ -1,7 +1,11 @@
1
- class Article < ActiveRecord::Base
2
- attr_accessible :content, :title
1
+ class Article
2
+ include Mongoid::Document
3
+ include Uploader::Fileuploads
4
+
5
+ field :content
6
+ field :title
3
7
 
4
- has_one :picture, :as => :assetable, :dependent => :destroy
8
+ has_one :picture, as: :assetable, dependent: :destroy
5
9
 
6
10
  fileuploads :picture
7
11
  end
@@ -1,27 +1,20 @@
1
- # == Schema Information
2
- #
3
- # Table name: assets
4
- #
5
- # id :integer(4) not null, primary key
6
- # data_file_name :string(255) not null
7
- # data_content_type :string(255)
8
- # data_file_size :integer(4)
9
- # assetable_id :integer(4) not null
10
- # assetable_type :string(25) not null
11
- # type :string(25)
12
- # guid :string(10)
13
- # user_id :integer(4)
14
- # sort_order :integer(4) default(0)
15
- # created_at :datetime
16
- # updated_at :datetime
17
- #
18
- # Indexes
19
- #
20
- # index_assets_on_assetable_type_and_assetable_id (assetable_type,assetable_id)
21
- # index_assets_on_user_id (user_id)
22
- #
23
- class Asset < ActiveRecord::Base
1
+ # encoding: utf-8
2
+
3
+ class Asset
4
+ include Mongoid::Document
24
5
  include Uploader::Asset
25
-
26
- belongs_to :assetable, :polymorphic => true
27
- end
6
+
7
+ belongs_to :assetable, polymorphic: true
8
+
9
+ field :guid
10
+
11
+ before_save do
12
+ return true if self.assetable_id.nil? || !self.assetable_id.is_a?(String)
13
+ if defined?(Moped::BSON)
14
+ self.assetable_id = Moped::BSON::ObjectId.from_string(self.assetable_id) if Moped::BSON::ObjectId.legal?(self.assetable_id)
15
+ else
16
+ self.assetable_id = BSON::ObjectId.from_string(self.assetable_id) if BSON::ObjectId.legal?(self.assetable_id)
17
+ end
18
+ true
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  class Picture < Asset
2
- mount_uploader :data, PictureUploader, :mount_on => :data_file_name
3
-
4
- attr_accessible :data
5
- end
4
+ mount_uploader :data, PictureUploader, mount_on: :data_file_name
5
+ end
@@ -1,11 +1,13 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require 'rails/all'
3
+ require "action_controller/railtie"
4
+ require "action_mailer/railtie"
5
+ require "sprockets/railtie"
4
6
 
5
7
  Bundler.require
6
- require "rails-uploader"
7
- require 'carrierwave'
8
- require 'carrierwave/orm/activerecord'
8
+
9
+ require 'glebtv-rails-uploader'
10
+ require 'carrierwave/mongoid'
9
11
 
10
12
  module Dummy
11
13
  class Application < Rails::Application
@@ -46,7 +48,7 @@ module Dummy
46
48
  # This will create an empty whitelist of attributes available for mass-assignment for all models
47
49
  # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
48
50
  # parameters by using an attr_accessible or attr_protected declaration.
49
- config.active_record.whitelist_attributes = true
51
+ # config.active_record.whitelist_attributes = true
50
52
 
51
53
  # Enable the asset pipeline
52
54
  config.assets.enabled = true
@@ -7,7 +7,7 @@ Dummy::Application.configure do
7
7
  config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
10
+ # config.whiny_nils = true
11
11
 
12
12
  # Show full error reports and disable caching
13
13
  config.consider_all_requests_local = true
@@ -34,4 +34,8 @@ Dummy::Application.configure do
34
34
 
35
35
  # Expands the lines which load the assets
36
36
  config.assets.debug = true
37
+
38
+ config.eager_load = false
39
+
40
+ config.secret_key_base = 'XXX'
37
41
  end
@@ -64,4 +64,8 @@ Dummy::Application.configure do
64
64
  # Log the query plan for queries taking more than this (works
65
65
  # with SQLite, MySQL, and PostgreSQL)
66
66
  # config.active_record.auto_explain_threshold_in_seconds = 0.5
67
+
68
+ config.eager_load = true
69
+
70
+ config.secret_key_base = 'XXX'
67
71
  end
@@ -12,7 +12,7 @@ Dummy::Application.configure do
12
12
  config.static_cache_control = "public, max-age=3600"
13
13
 
14
14
  # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
15
+ # config.whiny_nils = true
16
16
 
17
17
  # Show full error reports and disable caching
18
18
  config.consider_all_requests_local = true
@@ -30,8 +30,12 @@ Dummy::Application.configure do
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
32
  # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
33
+ # config.active_record.mass_assignment_sanitizer = :strict
34
34
 
35
35
  # Print deprecation notices to the stderr
36
36
  config.active_support.deprecation = :stderr
37
+
38
+ config.eager_load = false
39
+
40
+ config.secret_key_base = 'XXX'
37
41
  end
@@ -0,0 +1,12 @@
1
+ test:
2
+ sessions:
3
+ default:
4
+ database: rails-upload-test
5
+ hosts:
6
+ - localhost:27017
7
+ options:
8
+ consistency: :strong
9
+ # In the test environment we lower the retries and retry interval to
10
+ # low amounts for fast failures.
11
+ max_retries: 1
12
+ retry_interval: 0
@@ -0,0 +1,134 @@
1
+ MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} runtime: 0.7760ms
2
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=articles documents=[{"_id"=>BSON::ObjectId('5260e2af61732e16d5000000'), "title"=>"MyString", "content"=>"MyText"}] flags=[]
3
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 9.3263ms
4
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=assets documents=[{"_id"=>BSON::ObjectId('5260e2af61732e16d5010000'), "_type"=>"Picture", "data_file_name"=>"rails.png", "assetable_id"=>BSON::ObjectId('5260e2af61732e16d5000000'), "assetable_type"=>"Article"}] flags=[]
5
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 1.0125ms
6
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={"$query"=>{"guid"=>nil, "_type"=>{"$in"=>["Picture"]}}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.3457ms
7
+ MOPED: 127.0.0.1:27017 UPDATE database=rails_uploader_test collection=assets selector={"guid"=>nil, "assetable_type"=>"Article", "_type"=>{"$in"=>["Picture"]}} update={"$set"=>{"assetable_id"=>BSON::ObjectId('507f1f77bcf86cd799439011'), "guid"=>nil}} flags=[:multi]
8
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.3365ms
9
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={:_id=>BSON::ObjectId('5260e2af61732e16d5010000')} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.1396ms
10
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={"$query"=>{"guid"=>"nyvk1SDIWw", "_type"=>{"$in"=>["Picture"]}}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.2224ms
11
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.2285ms
12
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
13
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1906ms
14
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
15
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.9371ms
16
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=mongoid_pictures documents=[{"_id"=>BSON::ObjectId('5260e2af61732e16d5040000'), "guid"=>"guid", "assetable_type"=>"MongoidArticle"}] flags=[]
17
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.9922ms
18
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={"$query"=>{"guid"=>"guid"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.2235ms
19
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"mongoid_pictures", :query=>{}} runtime: 0.1327ms
20
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.1597ms
21
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={"_id"=>BSON::ObjectId('5260e2af61732e16d5040000')} flags=[:remove_first]
22
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2945ms
23
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=mongoid_pictures documents=[{"_id"=>BSON::ObjectId('5260e2af61732e16d5050000'), "guid"=>"guid", "assetable_type"=>"MongoidArticle"}] flags=[]
24
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2567ms
25
+ MOPED: 127.0.0.1:27017 UPDATE database=rails_uploader_test collection=mongoid_pictures selector={"guid"=>"guid", "assetable_type"=>"MongoidArticle"} update={"$set"=>{"assetable_id"=>BSON::ObjectId('507f1f77bcf86cd799439011'), "guid"=>nil}} flags=[:multi]
26
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2975ms
27
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={:_id=>BSON::ObjectId('5260e2af61732e16d5050000')} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.1648ms
28
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"mongoid_pictures", :query=>{}} runtime: 0.1498ms
29
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.1187ms
30
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={"_id"=>BSON::ObjectId('5260e2af61732e16d5050000')} flags=[:remove_first]
31
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1707ms
32
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.2008ms
33
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
34
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1986ms
35
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
36
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1759ms
37
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={} flags=[]
38
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1638ms
39
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2013-10-18 11:26:39 +0400
40
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=assets documents=[{"_id"=>BSON::ObjectId('5260e2af61732e16d5060000'), "_type"=>"Picture", "guid"=>"SOMESTRING", "assetable_type"=>"Article", "assetable_id"=>BSON::ObjectId('507f1f77bcf86cd799439011'), "data_file_name"=>"rails.png"}] flags=[]
41
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.4989ms
42
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=articles documents=[{"_id"=>BSON::ObjectId('5260e2af61732e16d5070000'), "title"=>"MyString", "content"=>"MyText"}] flags=[]
43
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.4983ms
44
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=assets documents=[{"_id"=>BSON::ObjectId('5260e2af61732e16d5080000'), "_type"=>"Picture", "data_file_name"=>"rails.png", "assetable_id"=>BSON::ObjectId('5260e2af61732e16d5070000'), "assetable_type"=>"Article"}] flags=[]
45
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1889ms
46
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"assets", :query=>{"_type"=>{"$in"=>["Picture"]}}} runtime: 0.2769ms
47
+ Started DELETE "/uploader/attachments/5260e2af61732e16d5080000" for 127.0.0.1 at 2013-10-18 11:26:39 +0400
48
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={"_id"=>BSON::ObjectId('5260e2af61732e16d5080000'), "_type"=>{"$in"=>["Picture"]}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.2434ms
49
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={"_id"=>BSON::ObjectId('5260e2af61732e16d5080000')} flags=[:remove_first]
50
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2557ms
51
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"assets", :query=>{"_type"=>{"$in"=>["Picture"]}}} runtime: 0.2002ms
52
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2013-10-18 11:26:39 +0400
53
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.3123ms
54
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
55
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.8245ms
56
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
57
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2291ms
58
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={} flags=[]
59
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1994ms
60
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.3214ms
61
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
62
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2060ms
63
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
64
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1767ms
65
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={} flags=[]
66
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1769ms
67
+ MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} runtime: 0.7348ms
68
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=articles documents=[{"_id"=>BSON::ObjectId('5260e2e261732e1735000000'), "title"=>"MyString", "content"=>"MyText"}] flags=[]
69
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2535ms
70
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=assets documents=[{"_id"=>BSON::ObjectId('5260e2e261732e1735010000'), "_type"=>"Picture", "data_file_name"=>"rails.png", "assetable_id"=>BSON::ObjectId('5260e2e261732e1735000000'), "assetable_type"=>"Article"}] flags=[]
71
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2518ms
72
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={"$query"=>{"guid"=>nil, "_type"=>{"$in"=>["Picture"]}}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.3935ms
73
+ MOPED: 127.0.0.1:27017 UPDATE database=rails_uploader_test collection=assets selector={"guid"=>nil, "assetable_type"=>"Article", "_type"=>{"$in"=>["Picture"]}} update={"$set"=>{"assetable_id"=>BSON::ObjectId('507f1f77bcf86cd799439011'), "guid"=>nil}} flags=[:multi]
74
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.3020ms
75
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={:_id=>BSON::ObjectId('5260e2e261732e1735010000')} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.1814ms
76
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={"$query"=>{"guid"=>"d2uYyLz0nT", "_type"=>{"$in"=>["Picture"]}}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.2770ms
77
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.3277ms
78
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
79
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2477ms
80
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
81
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2118ms
82
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={} flags=[]
83
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1612ms
84
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=mongoid_pictures documents=[{"_id"=>BSON::ObjectId('5260e2e261732e1735040000'), "guid"=>"guid", "assetable_type"=>"MongoidArticle"}] flags=[]
85
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2233ms
86
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={"$query"=>{"guid"=>"guid"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.2457ms
87
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"mongoid_pictures", :query=>{}} runtime: 0.1860ms
88
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.1527ms
89
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={"_id"=>BSON::ObjectId('5260e2e261732e1735040000')} flags=[:remove_first]
90
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2673ms
91
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=mongoid_pictures documents=[{"_id"=>BSON::ObjectId('5260e2e261732e1735050000'), "guid"=>"guid", "assetable_type"=>"MongoidArticle"}] flags=[]
92
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2020ms
93
+ MOPED: 127.0.0.1:27017 UPDATE database=rails_uploader_test collection=mongoid_pictures selector={"guid"=>"guid", "assetable_type"=>"MongoidArticle"} update={"$set"=>{"assetable_id"=>BSON::ObjectId('507f1f77bcf86cd799439011'), "guid"=>nil}} flags=[:multi]
94
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2262ms
95
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={:_id=>BSON::ObjectId('5260e2e261732e1735050000')} flags=[] limit=-1 skip=0 batch_size=nil fields=nil runtime: 0.1327ms
96
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"mongoid_pictures", :query=>{}} runtime: 0.1401ms
97
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.1612ms
98
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={"_id"=>BSON::ObjectId('5260e2e261732e1735050000')} flags=[:remove_first]
99
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2174ms
100
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.2162ms
101
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
102
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1359ms
103
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
104
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1241ms
105
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={} flags=[]
106
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1200ms
107
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2013-10-18 11:27:30 +0400
108
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=assets documents=[{"_id"=>BSON::ObjectId('5260e2e261732e1735060000'), "_type"=>"Picture", "guid"=>"SOMESTRING", "assetable_type"=>"Article", "assetable_id"=>BSON::ObjectId('507f1f77bcf86cd799439011'), "data_file_name"=>"rails.png"}] flags=[]
109
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.4041ms
110
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=articles documents=[{"_id"=>BSON::ObjectId('5260e2e261732e1735070000'), "title"=>"MyString", "content"=>"MyText"}] flags=[]
111
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.4249ms
112
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=assets documents=[{"_id"=>BSON::ObjectId('5260e2e261732e1735080000'), "_type"=>"Picture", "data_file_name"=>"rails.png", "assetable_id"=>BSON::ObjectId('5260e2e261732e1735070000'), "assetable_type"=>"Article"}] flags=[]
113
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.7119ms
114
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"assets", :query=>{"_type"=>{"$in"=>["Picture"]}}} runtime: 0.2731ms
115
+ Started DELETE "/uploader/attachments/5260e2e261732e1735080000" for 127.0.0.1 at 2013-10-18 11:27:30 +0400
116
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=assets selector={"_id"=>BSON::ObjectId('5260e2e261732e1735080000'), "_type"=>{"$in"=>["Picture"]}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.2229ms
117
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={"_id"=>BSON::ObjectId('5260e2e261732e1735080000')} flags=[:remove_first]
118
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.2614ms
119
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"assets", :query=>{"_type"=>{"$in"=>["Picture"]}}} runtime: 0.2077ms
120
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2013-10-18 11:27:30 +0400
121
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.2789ms
122
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
123
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1917ms
124
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
125
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1566ms
126
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={} flags=[]
127
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1501ms
128
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 0.2615ms
129
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=articles selector={} flags=[]
130
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1745ms
131
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=assets selector={} flags=[]
132
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1477ms
133
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={} flags=[]
134
+ COMMAND database=rails_uploader_test command={:getlasterror=>1, :w=>1} runtime: 0.1762ms