uploadcare-rails 0.5.3 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -2
- data/lib/uploadcare/rails/active_record.rb +12 -2
- data/lib/uploadcare/rails/settings.rb +2 -1
- data/lib/uploadcare/rails/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
[![Build Status](https://secure.travis-ci.org/uploadcare/uploadcare-rails.png?branch=master)](http://travis-ci.org/uploadcare/uploadcare-rails)
|
2
2
|
|
3
|
+
[Changelog](http://changelog.uploadcare.com/tagged/rails)
|
4
|
+
|
3
5
|
**Warning!** This plugin is of alpha quality. Some things may not work or be unexpectedly slow.
|
4
6
|
You are welcome to try it with your projects and report any issues with the latest release.
|
5
7
|
|
@@ -22,10 +24,18 @@ Uploadcare::Rails::Engine.configure do
|
|
22
24
|
config.uploadcare.public_key = 'demopublickey'
|
23
25
|
config.uploadcare.private_key = 'demoprivatekey'
|
24
26
|
config.uploadcare.widget_version = '0.8'
|
27
|
+
|
28
|
+
|
29
|
+
# Set the following to true if you don't want to propagate exceptions
|
30
|
+
# that are happening while storing a file (e.g. storing a file
|
31
|
+
# which no longer exists). They all are written to logger.error anyway.
|
32
|
+
|
33
|
+
config.uploadcare.silence_save_errors = false
|
34
|
+
|
25
35
|
end
|
26
36
|
```
|
27
37
|
|
28
|
-
(These are our *demo* keys. You can use them to try things out. Don't forget to change them to your own keys before building anything serious).
|
38
|
+
(These are our *demo* keys. You can use them to try things out. Don't forget to change them to your own keys before building anything serious).
|
29
39
|
|
30
40
|
## Models
|
31
41
|
|
@@ -65,7 +75,7 @@ Now we can use the Uploadcare widget in our forms:
|
|
65
75
|
|
66
76
|
```erb
|
67
77
|
<%= f.uploadcare_uploader_field :file %>
|
68
|
-
|
78
|
+
|
69
79
|
# or, if you use `simple_form`
|
70
80
|
<%= form.input :file, as: :uploadcare_uploader %>
|
71
81
|
```
|
@@ -37,9 +37,19 @@ module Uploadcare
|
|
37
37
|
"uploadcare.file.#{uuid}.store",
|
38
38
|
force: opts[:force_autostore]
|
39
39
|
)
|
40
|
+
|
40
41
|
unless stored
|
41
|
-
|
42
|
-
|
42
|
+
begin
|
43
|
+
send(attribute).api.store
|
44
|
+
::Rails.cache.write("uploadcare.file.#{uuid}.store", true)
|
45
|
+
rescue ArgumentError => e
|
46
|
+
|
47
|
+
logger.error "\nError while saving a file: #{e.class} (#{e.message}):"
|
48
|
+
logger.error "#{::Rails.backtrace_cleaner.clean(e.backtrace).join("\n ")}"
|
49
|
+
|
50
|
+
raise e unless ::Rails.application.config.uploadcare.silence_save_errors
|
51
|
+
end
|
52
|
+
|
43
53
|
end
|
44
54
|
end
|
45
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uploadcare-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.6'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04
|
12
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 2509194949765877850
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|
@@ -134,10 +134,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
segments:
|
136
136
|
- 0
|
137
|
-
hash:
|
137
|
+
hash: 2509194949765877850
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 1.8.
|
140
|
+
rubygems_version: 1.8.23
|
141
141
|
signing_key:
|
142
142
|
specification_version: 3
|
143
143
|
summary: Rails gem for uploadcare.com service.
|