rails-uploader 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc96a9340a601b0b4b543c19d1dbd91ba2e7eca4
4
- data.tar.gz: b8ad3626da4e00364cb2b8de3c11a4ffb52d6cc7
3
+ metadata.gz: 88c10bdc5c1c64828bf15e99962dee2c0e547eea
4
+ data.tar.gz: 00ad13f2236fa9751d588bfac7275578dab4bd99
5
5
  SHA512:
6
- metadata.gz: c2e7f39293ff34a4ffb393cfbb06286635513020fed1340c737409bd719b4f8b2a1a2b54719c1c5994e27b2a97a2249c3b4a9dcc504477f69b22907be607fd10
7
- data.tar.gz: 331c02315f949f2bddbe56dd0fba6c1d4217fadabd76b88ec72f19554f2b45d6fc1fcd95cdc1dd1aa54c5c1ee5fc1830dfca26311a5a6be0917c4784b57d2583
6
+ metadata.gz: 637a0ecdea91d3edabb08bb572a7a7739ae97ea6a2d8a8cbe76c724c64836c39fef17f9d6b94e96148a8f7a72bd685ea9c7615e48270e715a0e38d4e29bff136
7
+ data.tar.gz: 6cda451daaf4e3d7a5728dcfe49c2cf5e9b8fa07e78e76128fd3d50bc82ad45f5178ae1a15f6a57dc703d7907e321a19a8e4c8cb07d3c6a3d85fafd2e26fe0d6
@@ -5,7 +5,7 @@ module Uploader
5
5
  autoload :Fileuploads, 'uploader/fileuploads'
6
6
  autoload :Asset, 'uploader/asset'
7
7
  autoload :AssetInstance, 'uploader/asset_instance'
8
-
8
+
9
9
  module Helpers
10
10
  autoload :FormTagHelper, 'uploader/helpers/form_tag_helper'
11
11
  autoload :FormBuilder, 'uploader/helpers/form_builder'
@@ -15,11 +15,11 @@ module Uploader
15
15
  def self.guid
16
16
  SecureRandom.base64(16).tr('+/=', 'xyz').slice(0, 20)
17
17
  end
18
-
18
+
19
19
  def self.root_path
20
- @root_path ||= Pathname.new( File.dirname(File.expand_path('../', __FILE__)) )
20
+ @root_path ||= Pathname.new(File.dirname(File.expand_path('../', __FILE__)))
21
21
  end
22
-
22
+
23
23
  def self.assets
24
24
  Dir[root_path.join('vendor/assets/**/uploader/**', '*.{js,css,png,gif}')].inject([]) do |list, path|
25
25
  folder = path.split('/assets/')[1].split('/')[0]
@@ -34,17 +34,16 @@ module Uploader
34
34
  end
35
35
 
36
36
  def self.content_type(user_agent)
37
- return "application/json" if user_agent.blank?
37
+ return 'application/json' if user_agent.blank?
38
38
 
39
39
  ie_version = user_agent.scan(/(MSIE\s|rv:)([\d\.]+)/).flatten.last
40
-
41
- if user_agent.include?("Android") || (ie_version && ie_version.to_f <= 9.0) || (user_agent =~ /Trident\/[0-9\.]+\;/i)
42
- "text/plain"
40
+
41
+ if user_agent.include?('Android') || (ie_version && ie_version.to_f <= 9.0) || (user_agent =~ /Trident\/[0-9\.]+\;/i)
42
+ 'text/plain'
43
43
  else
44
- "application/json"
44
+ 'application/json'
45
45
  end
46
46
  end
47
-
48
47
  end
49
48
 
50
49
  require 'uploader/engine'
@@ -27,10 +27,7 @@ module Uploader
27
27
  json_data['filename'] = File.basename(data.path)
28
28
  json_data['size'] = data.file.size
29
29
  json_data['id'] = json_data['_id']
30
-
31
- if data.respond_to?(:thumb)
32
- json_data['thumb_url'] = data.thumb.url
33
- end
30
+ json_data['thumb_url'] = data.thumb.url if data.respond_to?(:thumb)
34
31
 
35
32
  json_data
36
33
  end
@@ -61,7 +58,7 @@ module Uploader
61
58
  #
62
59
  # class Asset < ActiveRecord::Base
63
60
  # include Uploader::Asset
64
- #
61
+ #
65
62
  # def uploader_create(params, request = nil)
66
63
  # self.user = request.env['warden'].user
67
64
  # super
@@ -74,13 +71,13 @@ module Uploader
74
71
  self.assetable_id = assetable_id_format(params[:assetable_id])
75
72
  save
76
73
  end
77
-
74
+
78
75
  # Destroy asset
79
76
  # Usage (cancan example):
80
77
  #
81
78
  # class Asset < ActiveRecord::Base
82
79
  # include Uploader::Asset
83
- #
80
+ #
84
81
  # def uploader_destroy(params, request = nil)
85
82
  # ability = Ability.new(request.env['warden'].user)
86
83
  # if ability.can? :delete, self
@@ -4,26 +4,22 @@ require 'uploader'
4
4
  module Uploader
5
5
  class Engine < ::Rails::Engine
6
6
  isolate_namespace Uploader
7
-
8
- initializer "uploader.assets_precompile" do |app|
7
+
8
+ initializer 'uploader.assets_precompile' do |app|
9
9
  app.config.assets.precompile += Uploader.assets
10
10
  end
11
-
12
- initializer "uploader.helpers" do
11
+
12
+ initializer 'uploader.helpers' do
13
13
  ActiveSupport.on_load :action_view do
14
14
  ActionView::Base.send(:include, Uploader::Helpers::FormTagHelper)
15
15
  ActionView::Helpers::FormBuilder.send(:include, Uploader::Helpers::FormBuilder)
16
16
  end
17
17
  end
18
-
19
- initializer "uploader.hooks" do
20
- require "uploader/hooks/active_record" if Object.const_defined?("ActiveRecord")
21
18
 
22
- if Object.const_defined?("SimpleForm")
23
- require "uploader/hooks/simple_form"
24
- elsif Object.const_defined?("Formtastic")
25
- require "uploader/hooks/formtastic"
26
- end
19
+ initializer 'uploader.hooks' do
20
+ require 'uploader/hooks/active_record' if Object.const_defined?('ActiveRecord')
21
+ require 'uploader/hooks/simple_form' if Object.const_defined?('SimpleForm')
22
+ require 'uploader/hooks/formtastic' if Object.const_defined?('Formtastic')
27
23
  end
28
24
  end
29
25
  end
@@ -17,7 +17,7 @@ module Uploader
17
17
  module SingletonMethods
18
18
  # Join ActiveRecord object with uploaded file
19
19
  # Usage:
20
- #
20
+ #
21
21
  # class Article < ActiveRecord::Base
22
22
  # has_one :picture, :as => :assetable, :dependent => :destroy
23
23
  #
@@ -27,40 +27,40 @@ module Uploader
27
27
  #
28
28
  def fileuploads(*args)
29
29
  options = args.extract_options!
30
-
31
- class_attribute :fileuploads_options, instance_writer: false
32
- self.fileuploads_options = options
33
-
34
- class_attribute :fileuploads_columns, instance_writer: false
35
- self.fileuploads_columns = args.map(&:to_sym)
36
-
37
- unless self.is_a?(ClassMethods)
30
+
31
+ unless respond_to?(:fileuploads_options)
32
+ class_attribute(:fileuploads_options, instance_writer: false)
33
+ self.fileuploads_options ||= {}
34
+
38
35
  include InstanceMethods
39
36
  extend ClassMethods
40
-
37
+
41
38
  after_save :fileuploads_update, if: :fileupload_changed?
42
-
43
- fileuploads_columns.each { |asset| accepts_nested_attributes_for(asset, allow_destroy: true) }
39
+ end
40
+
41
+ args.each do |name|
42
+ fileuploads_options[name] = options
43
+ accepts_nested_attributes_for(name, allow_destroy: true)
44
44
  end
45
45
  end
46
46
  end
47
-
47
+
48
48
  module ClassMethods
49
49
  # Update reflection klass by guid
50
50
  def fileupload_update(record_id, guid, method)
51
51
  fileupload_scope(method, guid).update_all(assetable_id: record_id, guid: nil)
52
52
  end
53
-
53
+
54
54
  # Find asset(s) by guid
55
55
  def fileupload_find(method, guid)
56
- _query = fileupload_scope(method, guid)
57
- fileupload_multiple?(method) ? _query : _query.first
56
+ query = fileupload_scope(method, guid)
57
+ fileupload_multiple?(method) ? query : query.first
58
58
  end
59
59
 
60
60
  def fileupload_scope(method, guid)
61
61
  fileupload_klass(method).where(guid: guid, assetable_type: base_class.name.to_s)
62
62
  end
63
-
63
+
64
64
  # Find class by reflection
65
65
  def fileupload_klass(method)
66
66
  reflect_on_association(method.to_sym).klass
@@ -69,7 +69,7 @@ module Uploader
69
69
  def fileupload_multiple?(method)
70
70
  association = reflect_on_association(method.to_sym)
71
71
 
72
- # many? for Mongoid, :collection? for AR
72
+ # many? for Mongoid and :collection? for AR
73
73
  method_name = association.respond_to?(:many?) ? :many? : :collection?
74
74
 
75
75
  !!(association && association.send(method_name))
@@ -81,26 +81,26 @@ module Uploader
81
81
  end
82
82
  end
83
83
  end
84
-
84
+
85
85
  module InstanceMethods
86
86
  # Generate unique key
87
87
  def fileupload_guid
88
88
  @fileupload_guid ||= Uploader.guid
89
89
  end
90
-
90
+
91
91
  def fileupload_guid=(value)
92
92
  @fileupload_changed = true unless value.blank?
93
93
  @fileupload_guid = value.blank? ? nil : value
94
94
  end
95
-
95
+
96
96
  def fileupload_changed?
97
- @fileupload_changed === true
97
+ @fileupload_changed == true
98
98
  end
99
-
99
+
100
100
  def fileupload_multiple?(method)
101
101
  self.class.fileupload_multiple?(method)
102
102
  end
103
-
103
+
104
104
  # Find or build new asset object
105
105
  def fileupload_asset(method)
106
106
  if fileuploads_columns.include?(method.to_sym)
@@ -109,18 +109,18 @@ module Uploader
109
109
  asset
110
110
  end
111
111
  end
112
-
112
+
113
113
  def fileuploads_columns
114
- self.class.fileuploads_columns
114
+ self.class.fileuploads_options.keys
115
115
  end
116
-
116
+
117
117
  protected
118
-
119
- def fileuploads_update
120
- fileuploads_columns.each do |method|
121
- self.class.fileupload_update(id, fileupload_guid, method)
122
- end
118
+
119
+ def fileuploads_update
120
+ fileuploads_options.each do |method, _options|
121
+ self.class.fileupload_update(id, fileupload_guid, method)
123
122
  end
123
+ end
124
124
  end
125
125
  end
126
126
  end
@@ -3,8 +3,8 @@ module Uploader
3
3
  class FieldTag
4
4
  attr_reader :template, :object, :theme
5
5
 
6
- delegate :uploader, to: :template
7
-
6
+ delegate :uploader, to: :template
7
+
8
8
  # Wrapper for render uploader field
9
9
  # Usage:
10
10
  #
@@ -12,13 +12,12 @@ module Uploader
12
12
  # uploader.render
13
13
  #
14
14
  def initialize(object_name, method_name, template, options = {}) #:nodoc:
15
- options = { object_name: object_name, method_name: method_name }.merge(options)
15
+ @options = { object_name: object_name, method_name: method_name }.merge(options)
16
+ @template = template
16
17
 
17
- @template, @options = template, options.dup
18
-
19
- @theme = (@options.delete(:theme) || "default")
18
+ @theme = (@options.delete(:theme) || 'default')
20
19
  @value = @options.delete(:value) if @options.key?(:value)
21
-
20
+
22
21
  @object = @options.delete(:object) if @options.key?(:object)
23
22
  @object ||= @template.instance_variable_get("@#{object_name}")
24
23
  end
@@ -27,31 +26,31 @@ module Uploader
27
26
  locals = { field: self }.merge(locals)
28
27
  @template.render(partial: "uploader/#{@theme}/container", locals: locals)
29
28
  end
30
-
29
+
31
30
  def id
32
31
  @id ||= @template.dom_id(@object, [method_name, 'uploader'].join('_'))
33
32
  end
34
-
33
+
35
34
  def method_name
36
35
  @options[:method_name]
37
36
  end
38
-
37
+
39
38
  def object_name
40
39
  @options[:object_name]
41
40
  end
42
-
41
+
43
42
  def multiple?
44
43
  @object.fileupload_multiple?(method_name)
45
44
  end
46
-
45
+
47
46
  def value
48
47
  @value ||= @object.fileupload_asset(method_name)
49
48
  end
50
-
49
+
51
50
  def values
52
51
  Array.wrap(value)
53
52
  end
54
-
53
+
55
54
  def exists?
56
55
  values.map(&:persisted?).any?
57
56
  end
@@ -59,28 +58,28 @@ module Uploader
59
58
  def sortable?
60
59
  @options[:sortable] == true
61
60
  end
62
-
61
+
63
62
  def klass
64
63
  @klass ||= @object.class.fileupload_klass(method_name)
65
64
  end
66
-
65
+
67
66
  def attachments_path(options = {})
68
67
  options = {
69
68
  guid: @object.fileupload_guid,
70
69
  assetable_type: @object.class.base_class.name.to_s,
71
70
  klass: klass.to_s
72
71
  }.merge(options)
73
-
72
+
74
73
  options[:assetable_id] = @object.id if @object.persisted?
75
-
74
+
76
75
  uploader.attachments_path(options)
77
76
  end
78
-
77
+
79
78
  def input_html
80
79
  @input_html ||= {
81
- data: {url: attachments_path},
80
+ data: { url: attachments_path },
82
81
  multiple: multiple?,
83
- class: "uploader"
82
+ class: 'uploader'
84
83
  }.merge(@options[:input_html] || {})
85
84
  end
86
85
  end
@@ -3,7 +3,7 @@ module Uploader
3
3
  module FormBuilder
4
4
  # Render uploader field
5
5
  # Usage:
6
- #
6
+ #
7
7
  # <%= form_for @article do |f| %>
8
8
  # <%= f.uploader_field :picture %>
9
9
  # <%= end %>
@@ -2,7 +2,7 @@ module Uploader
2
2
  module Helpers
3
3
  module FormTagHelper
4
4
  include ActionView::Helpers::JavaScriptHelper
5
-
5
+
6
6
  # A helper that renders file upload container
7
7
  #
8
8
  # <%= uploader_field_tag :article, :photo %>
@@ -1,19 +1,28 @@
1
1
  require 'formtastic'
2
2
 
3
- class UploaderInput
4
- include ::Formtastic::Inputs::Base
5
-
6
- def to_html
7
- input_wrapping do
8
- label_html <<
9
- builder.uploader_field(method, input_html_options)
10
- end
11
- end
3
+ module Formtastic
4
+ module Inputs
5
+ class UploaderInput
6
+ include ::Formtastic::Inputs::Base
7
+
8
+ def to_html
9
+ input_wrapping do
10
+ label_html << builder.uploader_field(method, input_html_options)
11
+ end
12
+ end
12
13
 
13
- def input_html_options
14
- data = super
15
- data[:confirm_delete] = options[:confirm_delete]
16
- data[:confirm_message] = localized_string(method, method, :delete_confirmation) || I18n.t('uploader.confirm_delete')
17
- data
14
+ def input_html_options
15
+ data = super
16
+ data[:confirm_delete] = options[:confirm_delete]
17
+ data[:confirm_message] = localized_confirm_message
18
+ data
19
+ end
20
+
21
+ protected
22
+
23
+ def localized_confirm_message
24
+ localized_string(method, method, :delete_confirmation) || I18n.t('uploader.confirm_delete')
25
+ end
26
+ end
18
27
  end
19
28
  end
@@ -1,8 +1,12 @@
1
- require "simple_form"
1
+ require 'simple_form'
2
2
 
3
- class UploaderInput < ::SimpleForm::Inputs::Base
4
- def input(wrapper_options = nil)
5
- merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
6
- @builder.uploader_field(attribute_name, merged_input_options)
3
+ module SimpleForm
4
+ module Inputs
5
+ class UploaderInput < ::SimpleForm::Inputs::Base
6
+ def input(wrapper_options = nil)
7
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
8
+ @builder.uploader_field(attribute_name, merged_input_options)
9
+ end
10
+ end
7
11
  end
8
12
  end
@@ -1,3 +1,3 @@
1
1
  module Uploader
2
- VERSION = "0.2.7".freeze
2
+ VERSION = '0.2.8'.freeze
3
3
  end
@@ -1,7 +1,5 @@
1
1
  class Article < ActiveRecord::Base
2
- attr_accessible :content, :title
3
-
4
- has_one :picture, :as => :assetable, :dependent => :destroy
2
+ has_one :picture, as: :assetable, dependent: :destroy
5
3
 
6
4
  fileuploads :picture
7
5
  end
@@ -22,6 +22,6 @@
22
22
  #
23
23
  class Asset < ActiveRecord::Base
24
24
  include Uploader::Asset
25
-
26
- belongs_to :assetable, :polymorphic => true
25
+
26
+ belongs_to :assetable, polymorphic: true
27
27
  end
@@ -1,5 +1,3 @@
1
1
  class Picture < Asset
2
- mount_uploader :data, PictureUploader, :mount_on => :data_file_name
3
-
4
- attr_accessible :data
2
+ mount_uploader :data, PictureUploader, mount_on: :data_file_name
5
3
  end
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require
6
- require "rails-uploader"
6
+ require 'rails-uploader'
7
7
  require 'carrierwave'
8
8
  require 'carrierwave/orm/activerecord'
9
9
 
@@ -32,7 +32,7 @@ module Dummy
32
32
  # config.i18n.default_locale = :de
33
33
 
34
34
  # Configure the default encoding used in templates for Ruby 1.9.
35
- config.encoding = "utf-8"
35
+ config.encoding = 'utf-8'
36
36
 
37
37
  # Configure sensitive parameters which will be filtered from the log file.
38
38
  config.filter_parameters += [:password]
@@ -42,12 +42,6 @@ module Dummy
42
42
  # like if you have constraints or database-specific column types
43
43
  # config.active_record.schema_format = :sql
44
44
 
45
- # Enforce whitelist mode for mass assignment.
46
- # This will create an empty whitelist of attributes available for mass-assignment for all models
47
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
48
- # parameters by using an attr_accessible or attr_protected declaration.
49
- config.active_record.whitelist_attributes = true
50
-
51
45
  # Enable the asset pipeline
52
46
  config.assets.enabled = true
53
47
 
@@ -22,9 +22,6 @@ Dummy::Application.configure do
22
22
  # Only use best-standards-support built into browsers
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
27
-
28
25
  # Log the query plan for queries taking more than this (works
29
26
  # with SQLite, MySQL, and PostgreSQL)
30
27
  config.active_record.auto_explain_threshold_in_seconds = 0.5
@@ -34,4 +31,6 @@ Dummy::Application.configure do
34
31
 
35
32
  # Expands the lines which load the assets
36
33
  config.assets.debug = true
34
+
35
+ config.eager_load = false
37
36
  end
@@ -64,4 +64,6 @@ 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
67
69
  end
@@ -29,9 +29,8 @@ Dummy::Application.configure do
29
29
  # ActionMailer::Base.deliveries array.
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
- # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
34
-
35
32
  # Print deprecation notices to the stderr
36
33
  config.active_support.deprecation = :stderr
34
+
35
+ config.eager_load = false
37
36
  end
Binary file
@@ -2894,3 +2894,282 @@ Started POST "/uploader/attachments" for 127.0.0.1 at 2015-09-16 17:13:13 +0300
2894
2894
   (0.1ms) begin transaction
2895
2895
   (0.1ms) rollback transaction
2896
2896
  MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=system.namespaces selector={:name=>{"$not"=>/system|\$/}} flags=[:slave_ok] limit=0 skip=0 fields=nil (0.4759ms)
2897
+ Connecting to database specified by database.yml
2898
+ Connecting to database specified by database.yml
2899
+ Connecting to database specified by database.yml
2900
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2901
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2902
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
2903
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:42:00 +0200
2904
+  (0.2ms) begin transaction
2905
+ Picture Exists (0.6ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'xbjexK94H2AHrQFFSyar' LIMIT 1
2906
+ SQL (1.7ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_file_name", "guid", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:42:00.862025"], ["data_file_name", "rails.png"], ["guid", "SOMESTRING"], ["public_token", "xbjexK94H2AHrQFFSyar"], ["type", "Picture"], ["updated_at", "2016-02-19 10:42:00.862025"]]
2907
+  (0.9ms) commit transaction
2908
+  (0.3ms) begin transaction
2909
+ SQL (1.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:42:01.003470"], ["title", "MyString"], ["updated_at", "2016-02-19 10:42:01.003470"]]
2910
+  (0.9ms) commit transaction
2911
+  (0.1ms) begin transaction
2912
+ Picture Exists (0.4ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = '0eo4f8NLHt0SK5bwpyFw' LIMIT 1
2913
+ SQL (0.6ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:42:01.015685"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "0eo4f8NLHt0SK5bwpyFw"], ["type", "Picture"], ["updated_at", "2016-02-19 10:42:01.015685"]]
2914
+  (1.1ms) commit transaction
2915
+ Started DELETE "/uploader/attachments/wrong" for 127.0.0.1 at 2016-02-19 12:42:01 +0200
2916
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'wrong' ORDER BY "assets"."id" ASC LIMIT 1
2917
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:42:01 +0200
2918
+  (1.1ms) DELETE FROM "assets";
2919
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2920
+  (0.8ms) DELETE FROM sqlite_sequence where name = 'assets';
2921
+  (0.7ms) DELETE FROM "articles";
2922
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2923
+  (0.9ms) DELETE FROM sqlite_sequence where name = 'articles';
2924
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2925
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:42:30 +0200
2926
+  (0.2ms) begin transaction
2927
+ Picture Exists (0.4ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'yW3Ss1OcqwtM57XLrUKQ' LIMIT 1
2928
+ SQL (1.6ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_file_name", "guid", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:42:30.372910"], ["data_file_name", "rails.png"], ["guid", "SOMESTRING"], ["public_token", "yW3Ss1OcqwtM57XLrUKQ"], ["type", "Picture"], ["updated_at", "2016-02-19 10:42:30.372910"]]
2929
+  (0.8ms) commit transaction
2930
+  (0.2ms) begin transaction
2931
+ SQL (1.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:42:30.466423"], ["title", "MyString"], ["updated_at", "2016-02-19 10:42:30.466423"]]
2932
+  (9.0ms) commit transaction
2933
+  (0.1ms) begin transaction
2934
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'POeizRav9l81GDrYKe7R' LIMIT 1
2935
+ SQL (0.9ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:42:30.515566"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "POeizRav9l81GDrYKe7R"], ["type", "Picture"], ["updated_at", "2016-02-19 10:42:30.515566"]]
2936
+  (0.7ms) commit transaction
2937
+  (0.2ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
2938
+ Started DELETE "/uploader/attachments/POeizRav9l81GDrYKe7R" for 127.0.0.1 at 2016-02-19 12:42:30 +0200
2939
+ Picture Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'POeizRav9l81GDrYKe7R' ORDER BY "assets"."id" ASC LIMIT 1
2940
+  (0.1ms) begin transaction
2941
+ SQL (0.4ms) DELETE FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? [["id", 2]]
2942
+  (0.8ms) commit transaction
2943
+  (0.2ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
2944
+  (0.1ms) begin transaction
2945
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:42:30.595708"], ["title", "MyString"], ["updated_at", "2016-02-19 10:42:30.595708"]]
2946
+  (0.9ms) commit transaction
2947
+  (0.1ms) begin transaction
2948
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'PAZMiwhkz1jMZPvOyb9x' LIMIT 1
2949
+ SQL (0.3ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 2], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:42:30.599987"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "PAZMiwhkz1jMZPvOyb9x"], ["type", "Picture"], ["updated_at", "2016-02-19 10:42:30.599987"]]
2950
+  (0.8ms) commit transaction
2951
+ Started DELETE "/uploader/attachments/wrong" for 127.0.0.1 at 2016-02-19 12:42:30 +0200
2952
+ Picture Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'wrong' ORDER BY "assets"."id" ASC LIMIT 1
2953
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:42:30 +0200
2954
+  (1.2ms) DELETE FROM "assets";
2955
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2956
+  (0.7ms) DELETE FROM sqlite_sequence where name = 'assets';
2957
+  (0.9ms) DELETE FROM "articles";
2958
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2959
+  (0.8ms) DELETE FROM sqlite_sequence where name = 'articles';
2960
+ ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
2961
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2962
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2963
+  (2.8ms) DELETE FROM "assets";
2964
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2965
+  (0.5ms) DELETE FROM sqlite_sequence where name = 'assets';
2966
+  (1.4ms) DELETE FROM "articles";
2967
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2968
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
2969
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2970
+  (2.3ms) DELETE FROM "assets";
2971
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2972
+  (0.5ms) DELETE FROM sqlite_sequence where name = 'assets';
2973
+  (1.2ms) DELETE FROM "articles";
2974
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2975
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
2976
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
2977
+  (2.6ms) DELETE FROM "assets";
2978
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2979
+  (0.5ms) DELETE FROM sqlite_sequence where name = 'assets';
2980
+  (1.2ms) DELETE FROM "articles";
2981
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2982
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
2983
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2984
+  (1.3ms) DELETE FROM "assets";
2985
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2986
+  (0.5ms) DELETE FROM sqlite_sequence where name = 'assets';
2987
+  (1.0ms) DELETE FROM "articles";
2988
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2989
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
2990
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2991
+  (1.4ms) DELETE FROM "assets";
2992
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2993
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'assets';
2994
+  (1.0ms) DELETE FROM "articles";
2995
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
2996
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
2997
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2998
+  (1.4ms) DELETE FROM "assets";
2999
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3000
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'assets';
3001
+  (0.8ms) DELETE FROM "articles";
3002
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3003
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
3004
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3005
+  (0.1ms) begin transaction
3006
+ SQL (0.5ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:47:58.842895"], ["title", "MyString"], ["updated_at", "2016-02-19 10:47:58.842895"]]
3007
+  (0.8ms) commit transaction
3008
+  (0.1ms) begin transaction
3009
+ Picture Exists (0.3ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'PyYDPgwxXibU5iebwvyT' LIMIT 1
3010
+ SQL (0.4ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:47:58.853151"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "PyYDPgwxXibU5iebwvyT"], ["type", "Picture"], ["updated_at", "2016-02-19 10:47:58.853151"]]
3011
+  (0.8ms) commit transaction
3012
+ Picture Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article' ORDER BY "assets"."id" ASC LIMIT 1
3013
+ SQL (1.1ms) UPDATE "assets" SET "assetable_id" = 1000, "guid" = NULL WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article'
3014
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? LIMIT 1 [["id", 1]]
3015
+  (1.0ms) DELETE FROM "assets";
3016
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3017
+  (0.9ms) DELETE FROM sqlite_sequence where name = 'assets';
3018
+  (0.7ms) DELETE FROM "articles";
3019
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3020
+  (0.9ms) DELETE FROM sqlite_sequence where name = 'articles';
3021
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
3022
+  (0.1ms) begin transaction
3023
+ SQL (1.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:48:45.357911"], ["title", "MyString"], ["updated_at", "2016-02-19 10:48:45.357911"]]
3024
+  (0.8ms) commit transaction
3025
+  (0.1ms) begin transaction
3026
+ Picture Exists (0.6ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'Ug2WHhK2fKyetxUgA5Ru' LIMIT 1
3027
+ SQL (1.7ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:48:45.369731"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "Ug2WHhK2fKyetxUgA5Ru"], ["type", "Picture"], ["updated_at", "2016-02-19 10:48:45.369731"]]
3028
+  (0.8ms) commit transaction
3029
+ Picture Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article' ORDER BY "assets"."id" ASC LIMIT 1
3030
+ SQL (1.1ms) UPDATE "assets" SET "assetable_id" = 1000, "guid" = NULL WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article'
3031
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? LIMIT 1 [["id", 1]]
3032
+ Picture Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" = 'OsjMNcX47yDKobKKKqEE' AND "assets"."assetable_type" = 'Article' ORDER BY "assets"."id" ASC LIMIT 1
3033
+  (1.2ms) DELETE FROM "assets";
3034
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3035
+  (1.0ms) DELETE FROM sqlite_sequence where name = 'assets';
3036
+  (0.8ms) DELETE FROM "articles";
3037
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3038
+  (0.8ms) DELETE FROM sqlite_sequence where name = 'articles';
3039
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
3040
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
3041
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
3042
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
3043
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
3044
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
3045
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
3046
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
3047
+  (0.1ms) begin transaction
3048
+ SQL (1.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:55:27.336912"], ["title", "MyString"], ["updated_at", "2016-02-19 10:55:27.336912"]]
3049
+  (0.8ms) commit transaction
3050
+  (0.2ms) begin transaction
3051
+ Picture Exists (0.7ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'FnvHlFpNIhxXucfU9hjH' LIMIT 1
3052
+ SQL (1.8ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:27.349889"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "FnvHlFpNIhxXucfU9hjH"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:27.349889"]]
3053
+  (0.9ms) commit transaction
3054
+ Picture Load (0.7ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article' ORDER BY "assets"."id" ASC LIMIT 1
3055
+ SQL (1.3ms) UPDATE "assets" SET "assetable_id" = 1000, "guid" = NULL WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article'
3056
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? LIMIT 1 [["id", 1]]
3057
+ Picture Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" = 'ynxazZOJmFvcsnPO6Spz' AND "assets"."assetable_type" = 'Article' ORDER BY "assets"."id" ASC LIMIT 1
3058
+  (3.8ms) DELETE FROM "assets";
3059
+  (0.3ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3060
+  (6.8ms) DELETE FROM sqlite_sequence where name = 'assets';
3061
+  (1.1ms) DELETE FROM "articles";
3062
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3063
+  (0.9ms) DELETE FROM sqlite_sequence where name = 'articles';
3064
+  (1.2ms) DELETE FROM "assets";
3065
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3066
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'assets';
3067
+  (1.0ms) DELETE FROM "articles";
3068
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3069
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
3070
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:55:28 +0200
3071
+  (0.2ms) begin transaction
3072
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'uvaCspoK4p0xCxTKfn0f' LIMIT 1
3073
+ SQL (0.4ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_file_name", "guid", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:28.105561"], ["data_file_name", "rails.png"], ["guid", "SOMESTRING"], ["public_token", "uvaCspoK4p0xCxTKfn0f"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:28.105561"]]
3074
+  (1.1ms) commit transaction
3075
+  (0.1ms) begin transaction
3076
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:55:28.181348"], ["title", "MyString"], ["updated_at", "2016-02-19 10:55:28.181348"]]
3077
+  (0.9ms) commit transaction
3078
+  (0.1ms) begin transaction
3079
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'bYoSV4vKkPX11bI4yh95' LIMIT 1
3080
+ SQL (0.3ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:28.185905"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "bYoSV4vKkPX11bI4yh95"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:28.185905"]]
3081
+  (0.8ms) commit transaction
3082
+  (0.2ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
3083
+ Started DELETE "/uploader/attachments/bYoSV4vKkPX11bI4yh95" for 127.0.0.1 at 2016-02-19 12:55:28 +0200
3084
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'bYoSV4vKkPX11bI4yh95' ORDER BY "assets"."id" ASC LIMIT 1
3085
+  (0.1ms) begin transaction
3086
+ SQL (0.3ms) DELETE FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? [["id", 2]]
3087
+  (1.6ms) commit transaction
3088
+  (0.2ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
3089
+  (0.1ms) begin transaction
3090
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:55:28.254449"], ["title", "MyString"], ["updated_at", "2016-02-19 10:55:28.254449"]]
3091
+  (0.8ms) commit transaction
3092
+  (0.1ms) begin transaction
3093
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'KGveJ86llLfSsFiYfZBI' LIMIT 1
3094
+ SQL (0.3ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 2], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:28.258544"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "KGveJ86llLfSsFiYfZBI"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:28.258544"]]
3095
+  (0.8ms) commit transaction
3096
+ Started DELETE "/uploader/attachments/wrong" for 127.0.0.1 at 2016-02-19 12:55:28 +0200
3097
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'wrong' ORDER BY "assets"."id" ASC LIMIT 1
3098
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:55:28 +0200
3099
+  (1.3ms) DELETE FROM "assets";
3100
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3101
+  (0.9ms) DELETE FROM sqlite_sequence where name = 'assets';
3102
+  (1.4ms) DELETE FROM "articles";
3103
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3104
+  (1.0ms) DELETE FROM sqlite_sequence where name = 'articles';
3105
+  (1.1ms) DELETE FROM "assets";
3106
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3107
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'assets';
3108
+  (0.8ms) DELETE FROM "articles";
3109
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3110
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
3111
+ ActiveRecord::SchemaMigration Load (0.5ms) SELECT "schema_migrations".* FROM "schema_migrations"
3112
+  (0.1ms) begin transaction
3113
+ SQL (0.5ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:55:35.721670"], ["title", "MyString"], ["updated_at", "2016-02-19 10:55:35.721670"]]
3114
+  (0.8ms) commit transaction
3115
+  (0.1ms) begin transaction
3116
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'HiROxaE0uS82ywQrM1bB' LIMIT 1
3117
+ SQL (0.4ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:35.732535"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "HiROxaE0uS82ywQrM1bB"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:35.732535"]]
3118
+  (0.9ms) commit transaction
3119
+ Picture Load (0.5ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article' ORDER BY "assets"."id" ASC LIMIT 1
3120
+ SQL (1.1ms) UPDATE "assets" SET "assetable_id" = 1000, "guid" = NULL WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article'
3121
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? LIMIT 1 [["id", 1]]
3122
+ Picture Load (0.3ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" = 'O1YZnsLfnUVMybkjpN7e' AND "assets"."assetable_type" = 'Article' ORDER BY "assets"."id" ASC LIMIT 1
3123
+  (1.1ms) DELETE FROM "assets";
3124
+  (0.3ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3125
+  (0.9ms) DELETE FROM sqlite_sequence where name = 'assets';
3126
+  (0.8ms) DELETE FROM "articles";
3127
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3128
+  (1.0ms) DELETE FROM sqlite_sequence where name = 'articles';
3129
+  (1.1ms) DELETE FROM "assets";
3130
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3131
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'assets';
3132
+  (0.9ms) DELETE FROM "articles";
3133
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3134
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
3135
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:55:35 +0200
3136
+  (0.2ms) begin transaction
3137
+ Picture Exists (0.4ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'j9im6FlvUTOFF4GFapxl' LIMIT 1
3138
+ SQL (0.4ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_file_name", "guid", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:35.905689"], ["data_file_name", "rails.png"], ["guid", "SOMESTRING"], ["public_token", "j9im6FlvUTOFF4GFapxl"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:35.905689"]]
3139
+  (1.0ms) commit transaction
3140
+  (0.2ms) begin transaction
3141
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:55:35.979833"], ["title", "MyString"], ["updated_at", "2016-02-19 10:55:35.979833"]]
3142
+  (0.9ms) commit transaction
3143
+  (0.1ms) begin transaction
3144
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'xs9Vi2ChWVPM1BGWgTqm' LIMIT 1
3145
+ SQL (0.3ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:35.983474"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "xs9Vi2ChWVPM1BGWgTqm"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:35.983474"]]
3146
+  (1.0ms) commit transaction
3147
+  (0.3ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
3148
+ Started DELETE "/uploader/attachments/xs9Vi2ChWVPM1BGWgTqm" for 127.0.0.1 at 2016-02-19 12:55:35 +0200
3149
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'xs9Vi2ChWVPM1BGWgTqm' ORDER BY "assets"."id" ASC LIMIT 1
3150
+  (0.1ms) begin transaction
3151
+ SQL (0.3ms) DELETE FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? [["id", 2]]
3152
+  (0.9ms) commit transaction
3153
+  (0.2ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
3154
+  (0.2ms) begin transaction
3155
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", "2016-02-19 10:55:36.051689"], ["title", "MyString"], ["updated_at", "2016-02-19 10:55:36.051689"]]
3156
+  (2.1ms) commit transaction
3157
+  (0.2ms) begin transaction
3158
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = '38sk1CwyEyMgItShzY0o' LIMIT 1
3159
+ SQL (0.3ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "public_token", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 2], ["assetable_type", "Article"], ["created_at", "2016-02-19 10:55:36.058434"], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["public_token", "38sk1CwyEyMgItShzY0o"], ["type", "Picture"], ["updated_at", "2016-02-19 10:55:36.058434"]]
3160
+  (0.9ms) commit transaction
3161
+ Started DELETE "/uploader/attachments/wrong" for 127.0.0.1 at 2016-02-19 12:55:36 +0200
3162
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'wrong' ORDER BY "assets"."id" ASC LIMIT 1
3163
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2016-02-19 12:55:36 +0200
3164
+  (1.3ms) DELETE FROM "assets";
3165
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3166
+  (1.0ms) DELETE FROM sqlite_sequence where name = 'assets';
3167
+  (0.8ms) DELETE FROM "articles";
3168
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3169
+  (0.9ms) DELETE FROM sqlite_sequence where name = 'articles';
3170
+  (1.3ms) DELETE FROM "assets";
3171
+  (0.2ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3172
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'assets';
3173
+  (0.9ms) DELETE FROM "articles";
3174
+  (0.1ms) SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';
3175
+  (0.1ms) DELETE FROM sqlite_sequence where name = 'articles';
@@ -1,17 +1,12 @@
1
- # Tell Mongoid which environment this configuration is for.
2
1
  test:
3
- # This starts the session configuration settings. You may have as
4
- # many sessions as you like, but you must have at least 1 named
5
- # 'default'.
6
- sessions:
7
- # Define the default session.
2
+ clients:
8
3
  default:
9
- # A session can have any number of hosts. Usually 1 for a single
10
- # server setup, and at least 3 for a replica set. Hosts must be
11
- # an array of host:port pairs. This session is single server.
4
+ database: rails_uploader_test
12
5
  hosts:
13
6
  - localhost:27017
14
- # Define the default database name.
15
- database: rails_uploader_test
16
- options:
17
- include_root_in_json: false
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
@@ -1,4 +1,7 @@
1
1
  require 'spec_helper'
2
+ require 'mongoid'
3
+
4
+ Mongoid.load!('spec/mongoid.yml', ENV['RAILS_ENV'])
2
5
 
3
6
  class MongoidArticle
4
7
  include Mongoid::Document
@@ -1,24 +1,22 @@
1
1
  # Configure Rails Envinronment
2
- ENV["RAILS_ENV"] = "test"
2
+ ENV['RAILS_ENV'] = 'test'
3
3
 
4
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
- require "rails/test_help"
6
- require "rspec/rails"
7
- require "database_cleaner"
4
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
5
+ require 'database_cleaner'
8
6
 
9
7
  # Fixtures replacement with a straightforward definition syntax
10
8
  require 'factory_girl'
11
- FactoryGirl.definition_file_paths = [ File.expand_path("../factories/", __FILE__) ]
9
+ FactoryGirl.definition_file_paths = [File.expand_path('../factories/', __FILE__)]
12
10
  FactoryGirl.find_definitions
13
11
 
14
12
  ActionMailer::Base.delivery_method = :test
15
13
  ActionMailer::Base.perform_deliveries = true
16
- ActionMailer::Base.default_url_options[:host] = "test.com"
14
+ ActionMailer::Base.default_url_options[:host] = 'test.com'
17
15
 
18
16
  Rails.backtrace_cleaner.remove_silencers!
19
17
 
20
18
  # Run any available migration
21
- ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
19
+ ActiveRecord::Migrator.migrate File.expand_path('../dummy/db/migrate/', __FILE__)
22
20
 
23
21
  require 'carrierwave'
24
22
  CarrierWave.configure do |config|
@@ -29,10 +27,6 @@ end
29
27
  # Load support files
30
28
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
31
29
 
32
- # Mongoid
33
- require 'mongoid'
34
- Mongoid.load!('spec/mongoid.yml')
35
-
36
30
  RSpec.configure do |config|
37
31
  # Remove this line if you don't want RSpec's should and should_not
38
32
  # methods or matchers
@@ -41,19 +35,19 @@ RSpec.configure do |config|
41
35
 
42
36
  # == Mock Framework
43
37
  config.mock_with :rspec
44
-
38
+
45
39
  config.before(:suite) do
46
40
  DatabaseCleaner[:active_record].strategy = :truncation
47
- DatabaseCleaner[:mongoid].strategy = :truncation
41
+ DatabaseCleaner[:mongoid].strategy = :truncation if Object.const_defined?('Mongoid')
48
42
  end
49
43
 
50
44
  config.before(:all) do
51
45
  DatabaseCleaner[:active_record].start
52
- DatabaseCleaner[:mongoid].start
46
+ DatabaseCleaner[:mongoid].start if Object.const_defined?('Mongoid')
53
47
  end
54
48
 
55
49
  config.after(:all) do
56
50
  DatabaseCleaner[:active_record].clean
57
- DatabaseCleaner[:mongoid].clean
51
+ DatabaseCleaner[:mongoid].clean if Object.const_defined?('Mongoid')
58
52
  end
59
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Galeta
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-16 00:00:00.000000000 Z
12
+ date: 2016-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-ui-rails
@@ -74,6 +74,9 @@ extensions: []
74
74
  extra_rdoc_files:
75
75
  - README.md
76
76
  files:
77
+ - MIT-LICENSE
78
+ - README.md
79
+ - Rakefile
77
80
  - app/assets/javascripts/uploader/application.js
78
81
  - app/assets/stylesheets/uploader/application.css
79
82
  - app/controllers/uploader/attachments_controller.rb
@@ -81,7 +84,12 @@ files:
81
84
  - app/views/uploader/default/_download.html.erb
82
85
  - app/views/uploader/default/_sortable.html.erb
83
86
  - app/views/uploader/default/_upload.html.erb
87
+ - config/locales/en.yml
88
+ - config/locales/ru.yml
89
+ - config/locales/uk.yml
90
+ - config/routes.rb
84
91
  - lib/rails-uploader.rb
92
+ - lib/uploader.rb
85
93
  - lib/uploader/asset.rb
86
94
  - lib/uploader/engine.rb
87
95
  - lib/uploader/fileuploads.rb
@@ -92,30 +100,8 @@ files:
92
100
  - lib/uploader/hooks/formtastic.rb
93
101
  - lib/uploader/hooks/simple_form.rb
94
102
  - lib/uploader/version.rb
95
- - lib/uploader.rb
96
- - config/locales/en.yml
97
- - config/locales/ru.yml
98
- - config/locales/uk.yml
99
- - config/routes.rb
100
- - vendor/assets/images/uploader/but_del_tag2.png
101
- - vendor/assets/images/uploader/ico_attach.png
102
- - vendor/assets/images/uploader/preloader.gif
103
- - vendor/assets/images/uploader/progressBarFillBg.png
104
- - vendor/assets/javascripts/uploader/jquery.fileupload-fp.js
105
- - vendor/assets/javascripts/uploader/jquery.fileupload-ui.js
106
- - vendor/assets/javascripts/uploader/jquery.fileupload.js
107
- - vendor/assets/javascripts/uploader/jquery.iframe-transport.js
108
- - vendor/assets/javascripts/uploader/jquery.ui.widget.js
109
- - vendor/assets/javascripts/uploader/load-image.min.js
110
- - vendor/assets/javascripts/uploader/locales/en.js
111
- - vendor/assets/javascripts/uploader/locales/ru.js
112
- - vendor/assets/javascripts/uploader/locales/uk.js
113
- - vendor/assets/javascripts/uploader/tmpl.min.js
114
- - vendor/assets/stylesheets/uploader/default.css
115
- - vendor/assets/stylesheets/uploader/jquery.fileupload-ui.css
116
- - MIT-LICENSE
117
- - Rakefile
118
- - README.md
103
+ - spec/dummy/README.rdoc
104
+ - spec/dummy/Rakefile
119
105
  - spec/dummy/app/assets/javascripts/application.js
120
106
  - spec/dummy/app/assets/stylesheets/application.css
121
107
  - spec/dummy/app/controllers/application_controller.rb
@@ -125,6 +111,7 @@ files:
125
111
  - spec/dummy/app/models/picture.rb
126
112
  - spec/dummy/app/uploaders/picture_uploader.rb
127
113
  - spec/dummy/app/views/layouts/application.html.erb
114
+ - spec/dummy/config.ru
128
115
  - spec/dummy/config/application.rb
129
116
  - spec/dummy/config/boot.rb
130
117
  - spec/dummy/config/database.yml
@@ -140,7 +127,6 @@ files:
140
127
  - spec/dummy/config/initializers/wrap_parameters.rb
141
128
  - spec/dummy/config/locales/en.yml
142
129
  - spec/dummy/config/routes.rb
143
- - spec/dummy/config.ru
144
130
  - spec/dummy/db/migrate/20120508093416_create_assets.rb
145
131
  - spec/dummy/db/migrate/20120508093830_create_articles.rb
146
132
  - spec/dummy/db/test.sqlite3
@@ -153,6 +139,8 @@ files:
153
139
  - spec/dummy/public/uploads/picture/data/1/thumb_rails.png
154
140
  - spec/dummy/public/uploads/picture/data/3/rails.png
155
141
  - spec/dummy/public/uploads/picture/data/3/thumb_rails.png
142
+ - spec/dummy/public/uploads/tmp/1455878520-6456-6895/rails.png
143
+ - spec/dummy/public/uploads/tmp/1455878520-6456-6895/thumb_rails.png
156
144
  - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/rails.png
157
145
  - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/thumb_rails.png
158
146
  - spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/rails.png
@@ -169,8 +157,6 @@ files:
169
157
  - spec/dummy/public/uploads/tmp/20130905-1726-34214-5471/thumb_rails.png
170
158
  - spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/rails.png
171
159
  - spec/dummy/public/uploads/tmp/20130905-1726-34214-9281/thumb_rails.png
172
- - spec/dummy/Rakefile
173
- - spec/dummy/README.rdoc
174
160
  - spec/dummy/script/rails
175
161
  - spec/factories/articles.rb
176
162
  - spec/factories/assets.rb
@@ -181,6 +167,22 @@ files:
181
167
  - spec/requests/attachments_controller_spec.rb
182
168
  - spec/spec_helper.rb
183
169
  - spec/uploader_spec.rb
170
+ - vendor/assets/images/uploader/but_del_tag2.png
171
+ - vendor/assets/images/uploader/ico_attach.png
172
+ - vendor/assets/images/uploader/preloader.gif
173
+ - vendor/assets/images/uploader/progressBarFillBg.png
174
+ - vendor/assets/javascripts/uploader/jquery.fileupload-fp.js
175
+ - vendor/assets/javascripts/uploader/jquery.fileupload-ui.js
176
+ - vendor/assets/javascripts/uploader/jquery.fileupload.js
177
+ - vendor/assets/javascripts/uploader/jquery.iframe-transport.js
178
+ - vendor/assets/javascripts/uploader/jquery.ui.widget.js
179
+ - vendor/assets/javascripts/uploader/load-image.min.js
180
+ - vendor/assets/javascripts/uploader/locales/en.js
181
+ - vendor/assets/javascripts/uploader/locales/ru.js
182
+ - vendor/assets/javascripts/uploader/locales/uk.js
183
+ - vendor/assets/javascripts/uploader/tmpl.min.js
184
+ - vendor/assets/stylesheets/uploader/default.css
185
+ - vendor/assets/stylesheets/uploader/jquery.fileupload-ui.css
184
186
  homepage: https://github.com/superp/rails-uploader
185
187
  licenses: []
186
188
  metadata: {}
@@ -200,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
202
  version: '0'
201
203
  requirements: []
202
204
  rubyforge_project: rails-uploader
203
- rubygems_version: 2.1.11
205
+ rubygems_version: 2.4.8
204
206
  signing_key:
205
207
  specification_version: 4
206
208
  summary: Rails file upload implementation with jQuery-File-Upload
@@ -242,6 +244,8 @@ test_files:
242
244
  - spec/dummy/public/uploads/picture/data/1/thumb_rails.png
243
245
  - spec/dummy/public/uploads/picture/data/3/rails.png
244
246
  - spec/dummy/public/uploads/picture/data/3/thumb_rails.png
247
+ - spec/dummy/public/uploads/tmp/1455878520-6456-6895/rails.png
248
+ - spec/dummy/public/uploads/tmp/1455878520-6456-6895/thumb_rails.png
245
249
  - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/rails.png
246
250
  - spec/dummy/public/uploads/tmp/20130905-1539-33540-9729/thumb_rails.png
247
251
  - spec/dummy/public/uploads/tmp/20130905-1542-33540-2188/rails.png