rails-uploader 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e9f68c0b656b627bdacf2628989d73b63c31647a
4
+ data.tar.gz: 9c4d638cb6b89af40cf599e3c3f7aef950239d79
5
+ SHA512:
6
+ metadata.gz: 924193e248df81257e025613fff57b74b4f8f76b09a8f59ec1cc2dc09a23a47050a20797f3b735b6e094b26d86a2d117f60d89527121a64e869b403c09331c32
7
+ data.tar.gz: 929c88e3d08db5fb926c6bf522667d1e8c5e9c36e59b1f63c783474a99cb423b08550c1ec8ff1fc8ac86113ac5bf7f5295da24371e93ea498bdeeeca48c17043
@@ -51,5 +51,6 @@ module Uploader
51
51
  self.content_type = Uploader.content_type(env["HTTP_USER_AGENT"])
52
52
  self.response_body = hash_or_object.to_json(:root => false)
53
53
  end
54
+
54
55
  end
55
56
  end
data/lib/uploader.rb CHANGED
@@ -4,6 +4,7 @@ require 'securerandom'
4
4
  module Uploader
5
5
  autoload :Fileuploads, 'uploader/fileuploads'
6
6
  autoload :Asset, 'uploader/asset'
7
+ autoload :AssetInstance, 'uploader/asset_instance'
7
8
 
8
9
  module Helpers
9
10
  autoload :FormTagHelper, 'uploader/helpers/form_tag_helper'
@@ -69,9 +69,10 @@ module Uploader
69
69
  # end
70
70
  #
71
71
  def uploader_create(params, request = nil)
72
+
72
73
  self.guid = params[:guid]
73
74
  self.assetable_type = params[:assetable_type]
74
- self.assetable_id = assetable_id_format(params[:assetable_id]) if params[:assetable_id]
75
+ self.assetable_id = assetable_id_format(params[:assetable_id])
75
76
  save
76
77
  end
77
78
 
@@ -101,7 +102,7 @@ module Uploader
101
102
  end
102
103
 
103
104
  def assetable_id_format(assetable_id)
104
- assetable_id
105
+ assetable_id || 0
105
106
  end
106
107
  end
107
108
  end
@@ -1,7 +1,8 @@
1
1
  require "simple_form"
2
2
 
3
3
  class UploaderInput < ::SimpleForm::Inputs::Base
4
- def input
5
- @builder.uploader_field(attribute_name, input_html_options)
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)
6
7
  end
7
8
  end
@@ -1,3 +1,3 @@
1
1
  module Uploader
2
- VERSION = "0.2.5".freeze
2
+ VERSION = "0.2.6".freeze
3
3
  end
@@ -2651,3 +2651,84 @@ Started POST "/uploader/attachments" for 127.0.0.1 at 2013-11-21 18:13:19 +0200
2651
2651
   (0.1ms) begin transaction
2652
2652
   (0.1ms) rollback transaction
2653
2653
  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.4461ms)
2654
+ Connecting to database specified by database.yml
2655
+  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
2656
+ Migrating to CreateAssets (20120508093416)
2657
+ Migrating to CreateArticles (20120508093830)
2658
+  (0.1ms) begin transaction
2659
+  (1.0ms) SAVEPOINT active_record_1
2660
+ SQL (2.8ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", Mon, 15 Jun 2015 08:27:26 UTC +00:00], ["title", "MyString"], ["updated_at", Mon, 15 Jun 2015 08:27:26 UTC +00:00]]
2661
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2662
+  (0.1ms) SAVEPOINT active_record_1
2663
+ Picture Exists (0.6ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'M4yogSJZYTBRNMVyFvyY' LIMIT 1
2664
+ SQL (2.2ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "data_file_size", "guid", "public_token", "type", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", Mon, 15 Jun 2015 08:27:26 UTC +00:00], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["data_file_size", nil], ["guid", nil], ["public_token", "M4yogSJZYTBRNMVyFvyY"], ["type", "Picture"], ["updated_at", Mon, 15 Jun 2015 08:27:26 UTC +00:00], ["user_id", nil]]
2665
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2666
+ Picture Load (0.1ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article' LIMIT 1
2667
+ SQL (0.3ms) UPDATE "assets" SET "assetable_id" = 1000, "guid" = NULL WHERE "assets"."type" IN ('Picture') AND "assets"."guid" IS NULL AND "assets"."assetable_type" = 'Article'
2668
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? LIMIT 1 [["id", 1]]
2669
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."guid" = 'OFd4CKWG8kWZadG83nyt' AND "assets"."assetable_type" = 'Article' LIMIT 1
2670
+  (0.1ms) SAVEPOINT active_record_1
2671
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2672
+  (0.9ms) rollback transaction
2673
+ MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (72.6321ms)
2674
+ 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 (10.3052ms)
2675
+  (0.1ms) begin transaction
2676
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={"public_token"=>"WzQHW0b7MgwOFzA0w36v"} flags=[:slave_ok] limit=1 skip=0 fields={:_id=>1} (14.7321ms)
2677
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=mongoid_pictures documents=[{"_id"=>"557e8c6edc26e7c103000001", "guid"=>"guid", "assetable_type"=>"MongoidArticle", "public_token"=>"WzQHW0b7MgwOFzA0w36v"}] flags=[] (0.2539ms)
2678
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={"$query"=>{"guid"=>"guid", "assetable_type"=>"MongoidArticle"}, "$orderby"=>{:_id=>1}} flags=[:slave_ok] limit=-1 skip=0 fields=nil (42.6080ms)
2679
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"mongoid_pictures", :query=>{}} (3.1428ms)
2680
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={} flags=[:slave_ok] limit=0 skip=0 fields=nil (0.3161ms)
2681
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={"_id"=>"557e8c6edc26e7c103000001"} flags=[:remove_first] (0.1340ms)
2682
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={"public_token"=>"ApIxKrqWMfKMfY41LAR9"} flags=[:slave_ok] limit=1 skip=0 fields={:_id=>1} (0.6771ms)
2683
+ MOPED: 127.0.0.1:27017 INSERT database=rails_uploader_test collection=mongoid_pictures documents=[{"_id"=>"557e8c6edc26e7c103000002", "guid"=>"guid", "assetable_type"=>"MongoidArticle", "public_token"=>"ApIxKrqWMfKMfY41LAR9"}] flags=[] (0.1130ms)
2684
+ MOPED: 127.0.0.1:27017 UPDATE database=rails_uploader_test collection=mongoid_pictures selector={"guid"=>"guid", "assetable_type"=>"MongoidArticle"} update={"$set"=>{:assetable_id=>1000, :guid=>nil}} flags=[:multi] (0.1309ms)
2685
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={:_id=>"557e8c6edc26e7c103000002"} flags=[:slave_ok] limit=-1 skip=0 fields=nil (3.0262ms)
2686
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:count=>"mongoid_pictures", :query=>{}} (0.2980ms)
2687
+ MOPED: 127.0.0.1:27017 QUERY database=rails_uploader_test collection=mongoid_pictures selector={} flags=[:slave_ok] limit=0 skip=0 fields=nil (0.2861ms)
2688
+ MOPED: 127.0.0.1:27017 DELETE database=rails_uploader_test collection=mongoid_pictures selector={"_id"=>"557e8c6edc26e7c103000002"} flags=[:remove_first] (0.1123ms)
2689
+  (0.1ms) rollback transaction
2690
+ 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.3400ms)
2691
+ MOPED: 127.0.0.1:27017 COMMAND database=rails_uploader_test command={:drop=>"mongoid_pictures"} (10.0429ms)
2692
+  (0.1ms) begin transaction
2693
+
2694
+
2695
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2015-06-15 11:27:26 +0300
2696
+  (0.1ms) SAVEPOINT active_record_1
2697
+ Picture Exists (0.2ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = '2j8DKDapRBfA20oiHZvP' LIMIT 1
2698
+ SQL (0.6ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "data_file_size", "guid", "public_token", "type", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["data_content_type", nil], ["data_file_name", "rails.png"], ["data_file_size", nil], ["guid", "SOMESTRING"], ["public_token", "2j8DKDapRBfA20oiHZvP"], ["type", "Picture"], ["updated_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["user_id", nil]]
2699
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2700
+  (0.1ms) SAVEPOINT active_record_1
2701
+ SQL (0.7ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["title", "MyString"], ["updated_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00]]
2702
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2703
+  (0.0ms) SAVEPOINT active_record_1
2704
+ Picture Exists (0.1ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'rjSC2eQxiyqjmSqW9ATA' LIMIT 1
2705
+ SQL (0.3ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "data_file_size", "guid", "public_token", "type", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 1], ["assetable_type", "Article"], ["created_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["data_file_size", nil], ["guid", nil], ["public_token", "rjSC2eQxiyqjmSqW9ATA"], ["type", "Picture"], ["updated_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["user_id", nil]]
2706
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2707
+  (0.1ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
2708
+
2709
+
2710
+ Started DELETE "/uploader/attachments/rjSC2eQxiyqjmSqW9ATA" for 127.0.0.1 at 2015-06-15 11:27:27 +0300
2711
+ Picture Load (0.2ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'rjSC2eQxiyqjmSqW9ATA' LIMIT 1
2712
+  (0.0ms) SAVEPOINT active_record_1
2713
+ SQL (0.1ms) DELETE FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."id" = ? [["id", 2]]
2714
+  (0.0ms) RELEASE SAVEPOINT active_record_1
2715
+  (0.1ms) SELECT COUNT(*) FROM "assets" WHERE "assets"."type" IN ('Picture')
2716
+  (0.1ms) SAVEPOINT active_record_1
2717
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "MyText"], ["created_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["title", "MyString"], ["updated_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00]]
2718
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2719
+  (0.0ms) SAVEPOINT active_record_1
2720
+ Picture Exists (0.1ms) SELECT 1 AS one FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = '6eUhharayYOCdXJWsElD' LIMIT 1
2721
+ SQL (0.2ms) INSERT INTO "assets" ("assetable_id", "assetable_type", "created_at", "data_content_type", "data_file_name", "data_file_size", "guid", "public_token", "type", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [["assetable_id", 2], ["assetable_type", "Article"], ["created_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["data_content_type", "image/png"], ["data_file_name", "rails.png"], ["data_file_size", nil], ["guid", nil], ["public_token", "6eUhharayYOCdXJWsElD"], ["type", "Picture"], ["updated_at", Mon, 15 Jun 2015 08:27:27 UTC +00:00], ["user_id", nil]]
2722
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2723
+
2724
+
2725
+ Started DELETE "/uploader/attachments/wrong" for 127.0.0.1 at 2015-06-15 11:27:27 +0300
2726
+ Picture Load (0.1ms) SELECT "assets".* FROM "assets" WHERE "assets"."type" IN ('Picture') AND "assets"."public_token" = 'wrong' LIMIT 1
2727
+
2728
+
2729
+ Started POST "/uploader/attachments" for 127.0.0.1 at 2015-06-15 11:27:27 +0300
2730
+  (0.8ms) rollback transaction
2731
+ 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.5350ms)
2732
+  (0.1ms) begin transaction
2733
+  (0.1ms) rollback transaction
2734
+ 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.4451ms)
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
5
- prerelease:
4
+ version: 0.2.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Igor Galeta
@@ -10,70 +9,62 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-03-18 00:00:00.000000000 Z
12
+ date: 2015-06-15 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: jquery-ui-rails
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0'
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: sqlite3
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ! '>='
32
+ - - ">="
37
33
  - !ruby/object:Gem::Version
38
34
  version: '0'
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ! '>='
39
+ - - ">="
45
40
  - !ruby/object:Gem::Version
46
41
  version: '0'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: carrierwave
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ! '>='
46
+ - - ">="
53
47
  - !ruby/object:Gem::Version
54
48
  version: '0'
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - ">="
61
54
  - !ruby/object:Gem::Version
62
55
  version: '0'
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: mongoid
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
- - - ! '>='
60
+ - - ">="
69
61
  - !ruby/object:Gem::Version
70
62
  version: '0'
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
- - - ! '>='
67
+ - - ">="
77
68
  - !ruby/object:Gem::Version
78
69
  version: '0'
79
70
  description: Rails HTML5 FileUpload helpers
@@ -192,27 +183,26 @@ files:
192
183
  - spec/uploader_spec.rb
193
184
  homepage: https://github.com/superp/rails-uploader
194
185
  licenses: []
186
+ metadata: {}
195
187
  post_install_message:
196
188
  rdoc_options: []
197
189
  require_paths:
198
190
  - lib
199
191
  required_ruby_version: !ruby/object:Gem::Requirement
200
- none: false
201
192
  requirements:
202
- - - ! '>='
193
+ - - ">="
203
194
  - !ruby/object:Gem::Version
204
195
  version: '0'
205
196
  required_rubygems_version: !ruby/object:Gem::Requirement
206
- none: false
207
197
  requirements:
208
- - - ! '>='
198
+ - - ">="
209
199
  - !ruby/object:Gem::Version
210
200
  version: '0'
211
201
  requirements: []
212
202
  rubyforge_project: rails-uploader
213
- rubygems_version: 1.8.25
203
+ rubygems_version: 2.1.11
214
204
  signing_key:
215
- specification_version: 3
205
+ specification_version: 4
216
206
  summary: Rails file upload implementation with jQuery-File-Upload
217
207
  test_files:
218
208
  - spec/dummy/app/assets/javascripts/application.js