s3_cors_fileupload 0.1.5 → 0.2.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.document +4 -3
  3. data/.gitignore +3 -7
  4. data/CHANGELOG.md +9 -1
  5. data/Gemfile +11 -11
  6. data/Gemfile.lock +66 -74
  7. data/README.md +4 -3
  8. data/Rakefile +7 -9
  9. data/lib/generators/s3_cors_fileupload/install/templates/s3_uploads.js +16 -22
  10. data/lib/generators/s3_cors_fileupload/install/templates/s3_uploads_controller.rb +1 -1
  11. data/lib/generators/s3_cors_fileupload/install/templates/source_file.rb +2 -2
  12. data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_download.html.erb +2 -2
  13. data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_upload.html.erb +4 -4
  14. data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_uploaded.html.erb +1 -1
  15. data/lib/generators/s3_cors_fileupload/install/templates/views/erb/index.html.erb +2 -2
  16. data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_download.html.haml +2 -2
  17. data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_upload.html.haml +4 -4
  18. data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_uploaded.html.haml +2 -2
  19. data/lib/generators/s3_cors_fileupload/install/templates/views/haml/index.html.haml +2 -2
  20. data/lib/s3_cors_fileupload/rails/config.rb +0 -1
  21. data/lib/s3_cors_fileupload/rails/form_helper.rb +2 -4
  22. data/lib/s3_cors_fileupload/rails/policy_helper.rb +2 -2
  23. data/lib/s3_cors_fileupload/version.rb +3 -3
  24. data/s3_cors_fileupload.gemspec +12 -15
  25. data/spec/dummy/Rakefile +7 -0
  26. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  27. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  28. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  29. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  30. data/spec/dummy/app/models/.gitkeep +0 -0
  31. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  32. data/spec/dummy/config.ru +4 -0
  33. data/spec/dummy/config/amazon_s3.yml +17 -0
  34. data/spec/dummy/config/application.rb +64 -0
  35. data/spec/dummy/config/boot.rb +10 -0
  36. data/spec/dummy/config/database.yml +25 -0
  37. data/spec/dummy/config/environment.rb +5 -0
  38. data/spec/dummy/config/environments/development.rb +37 -0
  39. data/spec/dummy/config/environments/production.rb +67 -0
  40. data/spec/dummy/config/environments/test.rb +37 -0
  41. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  42. data/spec/dummy/config/initializers/inflections.rb +15 -0
  43. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  44. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  45. data/spec/dummy/config/initializers/session_store.rb +8 -0
  46. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  47. data/spec/dummy/config/locales/en.yml +5 -0
  48. data/spec/dummy/config/routes.rb +58 -0
  49. data/spec/dummy/db/.gitkeep +0 -0
  50. data/spec/dummy/lib/assets/.gitkeep +0 -0
  51. data/spec/dummy/log/.gitkeep +0 -0
  52. data/spec/dummy/public/404.html +26 -0
  53. data/spec/dummy/public/422.html +26 -0
  54. data/spec/dummy/public/500.html +25 -0
  55. data/spec/dummy/public/favicon.ico +0 -0
  56. data/spec/dummy/script/rails +6 -0
  57. data/spec/lib/generators/install/install_generator_spec.rb +160 -0
  58. data/spec/lib/s3_cors_fileupload/rails/config_spec.rb +43 -0
  59. data/spec/{s3_cors_fileupload → lib/s3_cors_fileupload}/version_spec.rb +0 -0
  60. data/spec/spec_helper.rb +11 -2
  61. data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-ui.js +117 -43
  62. data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload.js +187 -92
  63. data/vendor/assets/javascripts/s3_cors_fileupload/jquery.iframe-transport.js +20 -7
  64. data/vendor/assets/javascripts/s3_cors_fileupload/vendor/jquery.ui.widget.js +72 -53
  65. data/vendor/assets/javascripts/s3_cors_fileupload/vendor/load-image.js +225 -37
  66. data/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb +6 -8
  67. metadata +78 -21
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 79391b654debb51c6dd03fe45b28cb12a1d06065
4
+ data.tar.gz: b06c05d0b17b59e005c8569e256356573fc88472
5
+ SHA512:
6
+ metadata.gz: c5637708ed1fb4f9c7d387f854e46817c70d3d29207f5faa14dfa7d8add69756c60d7a22f9024d955a7f373aa948725aa35d04faf1cd2615d91960b446c0d59a
7
+ data.tar.gz: ddf94cb6e3e397f1d4f8b20b5af3b441697c523b506290a1215188f86677d6f1ac24d191f9bd4d824f4a4e3847407113481d41eddc30a54226b06c276fbf42d4
data/.document CHANGED
@@ -1,5 +1,6 @@
1
+ lib/*.rb
1
2
  lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
3
+ -
4
+ README.md
5
+ CHANGELOG.md
5
6
  LICENSE.txt
data/.gitignore CHANGED
@@ -1,4 +1,7 @@
1
1
  .rvmrc
2
+ spec/dummy/db/*.sqlite3
3
+ spec/dummy/log/*.log
4
+ spec/dummy/tmp
2
5
 
3
6
  # rcov generated
4
7
  coverage
@@ -29,7 +32,6 @@ pkg
29
32
  # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
30
33
  #
31
34
  # For MacOS:
32
- #
33
35
  #.DS_Store
34
36
 
35
37
  # For TextMate
@@ -43,9 +45,3 @@ pkg
43
45
 
44
46
  # For vim:
45
47
  #*.swp
46
-
47
- # For redcar:
48
- #.redcar
49
-
50
- # For rubinius:
51
- #*.rbc
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.2.0 (Unreleased)
2
+
3
+ - Upgraded jQuery-File-Upload and the other JavaScript files it is dependent upon to the most recent releases (see [lib/s3\_cors\_fileupload/version.rb](https://github.com/fullbridge-batkins/s3_cors_fileupload/blob/master/lib/s3_cors_fileupload/version.rb) for the current version #'s)
4
+ - Adjusted the `s3_cors_fileupload_form_tag` view helper so that block arguments passed to it are inserted inside of the form tag as opposed to the end of it.
5
+ - Changed the default expiration time for the form from 1 hour to 10 hours.
6
+ - Added a lot more spec coverage.
7
+
1
8
  ## 0.1.5
2
9
 
3
10
  - Added option to select 'haml' as the language template for the view files on the install generator.
@@ -7,7 +14,8 @@
7
14
 
8
15
  - Added a `data-confirmation` option to the delete buttons and functionality to the jQuery-File-Upload UI's destroy callback that picks up the contents of that attribute to use as a confirmation dialog. (Fixed the implementation from v0.1.3) [See the README notes for more details](https://github.com/fullbridge-batkins/s3_cors_fileupload#notes).
9
16
 
10
- ## 0.1.3 (Yanked)
17
+ ## 0.1.3
18
+ *This version was yanked because the 'data-confirmation' feature (see 0.1.4) was broken in a way that caused the user to be prompted every time they clicked on the delete button, regardless of the option.*
11
19
 
12
20
  - Improving install generator so that generation of the migration file is optional.
13
21
  - Removed some unnecessary code on some of the generator templates.
data/Gemfile CHANGED
@@ -1,19 +1,19 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
- # Bundler will treat runtime dependencies like base dependencies, and
4
- # development dependencies will be added by default to the :development group.
5
- gemspec
6
-
7
- # Add dependencies to develop your gem here.
8
- # Include everything needed to run rake, tests, features, etc.
9
3
  group :development do
10
4
  gem 'rdoc', '~> 3.12'
11
- gem 'gem-release', '~> 0.4'
5
+ gem 'gem-release', '~> 0.5'
12
6
  end
13
7
 
14
8
  group :test do
15
- gem 'rails'
9
+ gem 'rspec-rails', '~> 2.13'
10
+ gem 'shoulda-matchers', '~> 2.0'
11
+ gem 'generator_spec'
12
+ gem 'ffaker'
13
+
14
+ # dependencies for S3CorsFileUpload
15
+ gem 'rails', '~> 3.2'
16
+ # gem 'jquery-rails' # would be necessary to do UI testing on the dummy app
16
17
  gem 'sqlite3' # the database driver for rails
17
- gem 'rspec-rails', '~> 2.11'
18
- gem 'shoulda-matchers'
18
+ gem 'aws-s3'
19
19
  end
data/Gemfile.lock CHANGED
@@ -1,40 +1,32 @@
1
- PATH
2
- remote: .
3
- specs:
4
- s3_cors_fileupload (0.1.4)
5
- aws-s3 (~> 0.6)
6
- jquery-rails (>= 2.0)
7
- rails (~> 3.1)
8
-
9
1
  GEM
10
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
11
3
  specs:
12
- actionmailer (3.2.8)
13
- actionpack (= 3.2.8)
14
- mail (~> 2.4.4)
15
- actionpack (3.2.8)
16
- activemodel (= 3.2.8)
17
- activesupport (= 3.2.8)
4
+ actionmailer (3.2.13)
5
+ actionpack (= 3.2.13)
6
+ mail (~> 2.5.3)
7
+ actionpack (3.2.13)
8
+ activemodel (= 3.2.13)
9
+ activesupport (= 3.2.13)
18
10
  builder (~> 3.0.0)
19
11
  erubis (~> 2.7.0)
20
12
  journey (~> 1.0.4)
21
- rack (~> 1.4.0)
13
+ rack (~> 1.4.5)
22
14
  rack-cache (~> 1.2)
23
15
  rack-test (~> 0.6.1)
24
- sprockets (~> 2.1.3)
25
- activemodel (3.2.8)
26
- activesupport (= 3.2.8)
16
+ sprockets (~> 2.2.1)
17
+ activemodel (3.2.13)
18
+ activesupport (= 3.2.13)
27
19
  builder (~> 3.0.0)
28
- activerecord (3.2.8)
29
- activemodel (= 3.2.8)
30
- activesupport (= 3.2.8)
20
+ activerecord (3.2.13)
21
+ activemodel (= 3.2.13)
22
+ activesupport (= 3.2.13)
31
23
  arel (~> 3.0.2)
32
24
  tzinfo (~> 0.3.29)
33
- activeresource (3.2.8)
34
- activemodel (= 3.2.8)
35
- activesupport (= 3.2.8)
36
- activesupport (3.2.8)
37
- i18n (~> 0.6)
25
+ activeresource (3.2.13)
26
+ activemodel (= 3.2.13)
27
+ activesupport (= 3.2.13)
28
+ activesupport (3.2.13)
29
+ i18n (= 0.6.1)
38
30
  multi_json (~> 1.0)
39
31
  arel (3.0.2)
40
32
  aws-s3 (0.6.3)
@@ -42,86 +34,86 @@ GEM
42
34
  mime-types
43
35
  xml-simple
44
36
  builder (3.0.4)
45
- diff-lcs (1.1.3)
37
+ diff-lcs (1.2.4)
46
38
  erubis (2.7.0)
47
- gem-release (0.4.1)
48
- hike (1.2.1)
39
+ ffaker (1.15.0)
40
+ gem-release (0.5.5)
41
+ generator_spec (0.8.7)
42
+ activerecord (>= 3.0, < 4.0)
43
+ railties (>= 3.0, < 4.0)
44
+ hike (1.2.2)
49
45
  i18n (0.6.1)
50
46
  journey (1.0.4)
51
- jquery-rails (2.1.3)
52
- railties (>= 3.1.0, < 5.0)
53
- thor (~> 0.14)
54
- json (1.7.5)
55
- mail (2.4.4)
47
+ json (1.7.7)
48
+ mail (2.5.3)
56
49
  i18n (>= 0.4.0)
57
50
  mime-types (~> 1.16)
58
51
  treetop (~> 1.4.8)
59
- mime-types (1.19)
60
- multi_json (1.3.6)
52
+ mime-types (1.23)
53
+ multi_json (1.7.2)
61
54
  polyglot (0.3.3)
62
- rack (1.4.1)
55
+ rack (1.4.5)
63
56
  rack-cache (1.2)
64
57
  rack (>= 0.4)
65
- rack-ssl (1.3.2)
58
+ rack-ssl (1.3.3)
66
59
  rack
67
60
  rack-test (0.6.2)
68
61
  rack (>= 1.0)
69
- rails (3.2.8)
70
- actionmailer (= 3.2.8)
71
- actionpack (= 3.2.8)
72
- activerecord (= 3.2.8)
73
- activeresource (= 3.2.8)
74
- activesupport (= 3.2.8)
62
+ rails (3.2.13)
63
+ actionmailer (= 3.2.13)
64
+ actionpack (= 3.2.13)
65
+ activerecord (= 3.2.13)
66
+ activeresource (= 3.2.13)
67
+ activesupport (= 3.2.13)
75
68
  bundler (~> 1.0)
76
- railties (= 3.2.8)
77
- railties (3.2.8)
78
- actionpack (= 3.2.8)
79
- activesupport (= 3.2.8)
69
+ railties (= 3.2.13)
70
+ railties (3.2.13)
71
+ actionpack (= 3.2.13)
72
+ activesupport (= 3.2.13)
80
73
  rack-ssl (~> 1.3.2)
81
74
  rake (>= 0.8.7)
82
75
  rdoc (~> 3.4)
83
76
  thor (>= 0.14.6, < 2.0)
84
- rake (0.9.2.2)
85
- rdoc (3.12)
77
+ rake (10.0.4)
78
+ rdoc (3.12.2)
86
79
  json (~> 1.4)
87
- rspec (2.11.0)
88
- rspec-core (~> 2.11.0)
89
- rspec-expectations (~> 2.11.0)
90
- rspec-mocks (~> 2.11.0)
91
- rspec-core (2.11.1)
92
- rspec-expectations (2.11.3)
93
- diff-lcs (~> 1.1.3)
94
- rspec-mocks (2.11.3)
95
- rspec-rails (2.11.4)
80
+ rspec-core (2.13.1)
81
+ rspec-expectations (2.13.0)
82
+ diff-lcs (>= 1.1.3, < 2.0)
83
+ rspec-mocks (2.13.1)
84
+ rspec-rails (2.13.1)
96
85
  actionpack (>= 3.0)
97
86
  activesupport (>= 3.0)
98
87
  railties (>= 3.0)
99
- rspec (~> 2.11.0)
100
- shoulda-matchers (1.4.1)
88
+ rspec-core (~> 2.13.0)
89
+ rspec-expectations (~> 2.13.0)
90
+ rspec-mocks (~> 2.13.0)
91
+ shoulda-matchers (2.0.0)
101
92
  activesupport (>= 3.0.0)
102
- sprockets (2.1.3)
93
+ sprockets (2.2.2)
103
94
  hike (~> 1.2)
95
+ multi_json (~> 1.0)
104
96
  rack (~> 1.0)
105
97
  tilt (~> 1.1, != 1.3.0)
106
- sqlite3 (1.3.6)
107
- thor (0.16.0)
108
- tilt (1.3.3)
98
+ sqlite3 (1.3.7)
99
+ thor (0.18.1)
100
+ tilt (1.3.7)
109
101
  treetop (1.4.12)
110
102
  polyglot
111
103
  polyglot (>= 0.3.1)
112
- tzinfo (0.3.34)
104
+ tzinfo (0.3.37)
113
105
  xml-simple (1.1.2)
114
106
 
115
107
  PLATFORMS
116
108
  ruby
117
109
 
118
110
  DEPENDENCIES
119
- bundler
120
- gem-release (~> 0.4)
121
- rails
122
- rake (>= 0.8.7)
111
+ aws-s3
112
+ ffaker
113
+ gem-release (~> 0.5)
114
+ generator_spec
115
+ rails (~> 3.2)
123
116
  rdoc (~> 3.12)
124
- rspec-rails (~> 2.11)
125
- s3_cors_fileupload!
126
- shoulda-matchers
117
+ rspec-rails (~> 2.13)
118
+ shoulda-matchers (~> 2.0)
127
119
  sqlite3
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # S3CorsFileupload
2
2
 
3
- A gem to allow for uploading of files to directly AWS-S3 via [CORS](http://www.w3.org/TR/cors/) via the
3
+ A gem to allow for uploading of files to directly AWS-S3 via [CORS](http://www.w3.org/TR/cors/) using the
4
4
  [jQuery-File-Upload javascript](http://blueimp.github.com/jQuery-File-Upload/) for Rails 3.1 and greater.
5
5
 
6
6
  ## Installation
@@ -16,7 +16,8 @@ and views for the file uploading.
16
16
 
17
17
  bundle exec rails generate s3_cors_fileupload:install
18
18
 
19
- If you are using HAML as the template language for your app, you can make the install generator produce HAML view files:
19
+ If you are using HAML as the template language for your app, the install generator has an option to produce
20
+ HAML view files (the default is ERB):
20
21
 
21
22
  bundle exec rails g s3_cors_fileupload:install --template-language=haml
22
23
 
@@ -121,7 +122,7 @@ mimics that of Rails's built in [jquery-ujs behavior for `data-confirm`](https:/
121
122
  attributes on forms (I named this one `data-confirmation` to prevent jquery-ujs from conflicts).
122
123
  The code for this was based off of [pull request #1127 to the jQuery-File-Upload project](https://github.com/blueimp/jQuery-File-Upload/pull/1127),
123
124
  which appears to have been rejected by the author of jQuery-File-Upload, but seems appropriate for rails. If you wish not to use it,
124
- simply remove the `data-confirm` attribute from the destroy button on `_template_uploaded.html.erb` in the views directory.
125
+ simply remove the `data-confirmation` attribute from the destroy button on `_template_uploaded.html.erb` in the views directory.
125
126
 
126
127
  ## Contributing to S3CorsFileupload
127
128
 
data/Rakefile CHANGED
@@ -1,17 +1,16 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'rubygems'
4
- # begin
5
- # require 'bundler/setup'
6
- # rescue LoadError
7
- # puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
- # end
4
+ begin
5
+ require 'bundler/setup'
6
+ rescue LoadError
7
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
+ end
9
9
  Bundler::GemHelper.install_tasks
10
10
 
11
11
  require 'rspec/core/rake_task'
12
12
  RSpec::Core::RakeTask.new('spec')
13
13
 
14
- # If you want to make this the default task
15
14
  task :default => :spec
16
15
 
17
16
  # require 'rcov/rcovtask'
@@ -25,12 +24,11 @@ task :default => :spec
25
24
  # task :default => :test
26
25
 
27
26
  require 'rdoc/task'
28
- Rake::RDocTask.new do |rdoc|
27
+ RDoc::Task.new do |rdoc|
29
28
  require File.expand_path('../lib/s3_cors_fileupload/version', __FILE__)
30
- version = S3CorsFileupload::VERSION
31
29
 
32
30
  rdoc.rdoc_dir = 'rdoc'
33
- rdoc.title = "S3CorsFileupload #{version}"
31
+ rdoc.title = "S3CorsFileupload #{S3CorsFileupload::VERSION}"
34
32
  rdoc.rdoc_files.include('LICENSE*')
35
33
  rdoc.rdoc_files.include('README*')
36
34
  rdoc.rdoc_files.include('CHANGELOG*')
@@ -2,7 +2,7 @@
2
2
  * s3-cors-file-upload
3
3
  * http://github.com/fullbridge-batkins/s3_cors_fileupload
4
4
  *
5
- * Copyright 2012, Ben Atkins
5
+ * Copyright 2013, Ben Atkins
6
6
  * http://batkins.net
7
7
  *
8
8
  * Licensed under the MIT license:
@@ -17,23 +17,17 @@ $(function() {
17
17
  $('#fileupload').bind('fileuploadadd', function (e, data) {
18
18
  var content_type = data.files[0].type;
19
19
  var file_name = data.files[0].name;
20
- $.ajax({
21
- url: '/source_files/generate_key',
22
- type: 'GET',
23
- dataType: 'json',
24
- data: {filename: file_name}, // send the file name to the server so it can generate the key param
25
- async: false,
26
- success: function(data) {
27
- // Now that we have our data, we add it to the global s3_upload_hash so that it can be
28
- // accessed (in the fileuploadsubmit callback) prior to being submitted
29
- s3_upload_hash[file_name] = {
30
- key: data.key,
31
- content_type: content_type
32
- };
33
- }
34
- })
35
- });
36
-
20
+
21
+ $.getJSON('/source_files/generate_key.json', {filename: file_name}, function(data) {
22
+ // Now that we have our data, we add it to the global s3_upload_hash so that it can be
23
+ // accessed (in the fileuploadsubmit callback) prior to being submitted
24
+ s3_upload_hash[file_name] = {
25
+ key: data.key,
26
+ content_type: content_type
27
+ };
28
+ });
29
+ });
30
+
37
31
  // this gets triggered right before a file is about to be sent (and have their form action submitted)
38
32
  $('#fileupload').bind('fileuploadsubmit', function (e, data) {
39
33
  var file_name = data.files[0].name;
@@ -43,7 +37,7 @@ $(function() {
43
37
  form.find('input[name=Content-Type]').val(s3_upload_hash[file_name]['content_type']);
44
38
  delete s3_upload_hash[file_name];
45
39
  });
46
-
40
+
47
41
  $('#fileupload').bind('fileuploaddone', function (e, data) {
48
42
  // the response will be XML, and can be accessed by calling `data.result`
49
43
  //
@@ -55,7 +49,7 @@ $(function() {
55
49
  // <ETag>"c7902ef289687931f34f92b65afda320"</ETag>
56
50
  // </PostResponse>
57
51
 
58
- $.post('/source_files',
52
+ $.post('/source_files.json',
59
53
  {
60
54
  'source_file[url]': $(data.result).find('Location').text(),
61
55
  'source_file[bucket]': $(data.result).find('Bucket').text(),
@@ -68,14 +62,14 @@ $(function() {
68
62
  'json'
69
63
  );
70
64
  });
71
-
65
+
72
66
  // remove the table row containing the source file information from the page
73
67
  $('#fileupload').bind('fileuploaddestroyed', function (e, data) {
74
68
  var deleted_object_id = data.url.split('/').pop();
75
69
  // now remove the element from the page
76
70
  $('#source_file_' + deleted_object_id).remove();
77
71
  });
78
-
72
+
79
73
  });
80
74
 
81
75
  // used for displaying approximate file size on the file listing index.
@@ -6,7 +6,7 @@ class S3UploadsController < ApplicationController
6
6
 
7
7
  respond_to do |format|
8
8
  format.html # index.html.erb
9
- format.json { render json: @source_files.map{|sf| sf.to_jq_upload } }
9
+ format.json { render json: @source_files.map(&:to_jq_upload) }
10
10
  end
11
11
  end
12
12
 
@@ -40,13 +40,13 @@ class SourceFile < ActiveRecord::Base
40
40
  end
41
41
 
42
42
  def self.open_aws
43
- unless AWS::S3::Base.connected?
43
+ unless @aws_connected
44
44
  AWS::S3::Base.establish_connection!(
45
45
  :access_key_id => S3CorsFileupload::Config.access_key_id,
46
46
  :secret_access_key => S3CorsFileupload::Config.secret_access_key
47
47
  )
48
48
  end
49
- return AWS::S3::Base.connected?
49
+ @aws_connected ||= AWS::S3::Base.connected?
50
50
  end
51
51
  #---- end S3 related methods -----
52
52