rails_imager 0.0.28 → 0.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/app/helpers/rails_imager/images_helper.rb +9 -4
- data/lib/rails_imager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad885a728aa0846c006101b996e62bbd99819421
|
4
|
+
data.tar.gz: afca7bba536f7d5a2463cbc48c5456fe9566f03b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 304e153bf47f4e333ca0c6a94c59fa3b049c25c12e903d95e6ff1176606f056ccbddbb4d7d7ff2846c4bd1b8b3259b3d78ffd00342348f1683b294ac02e1253f
|
7
|
+
data.tar.gz: dae814c368d23c0565491dee9b46a2cb5282f11451c3608ca41098fef027379989b2fc8f1b425839977f7d0156b40fad39bdc4a20f7815ad502af3497228932e
|
data/README.md
CHANGED
@@ -31,6 +31,11 @@ module ApplicationHelper
|
|
31
31
|
end
|
32
32
|
```
|
33
33
|
|
34
|
+
In case you use RailsImager in an engine, you might want to alter the path through an initializer file (config/initializers/rails_imager.rb):
|
35
|
+
```ruby
|
36
|
+
RailsImager.config.path = "/my_engine/rails_imager"
|
37
|
+
```
|
38
|
+
|
34
39
|
## Capistrano
|
35
40
|
|
36
41
|
If you use Capistrano to deploy, you probably symlink the "public/system" directory, in order to share uploaded images between releases. This screws with RailsImager's security only to serve images from the "public"-folder.
|
@@ -73,10 +73,15 @@ private
|
|
73
73
|
|
74
74
|
def path_from_arg(path)
|
75
75
|
if path.class.name == "Paperclip::Attachment"
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
# Ignore check when running tests - its normal to store Paperclip::Attachment's elsewhere for easy cleanup
|
77
|
+
if Rails.env.test?
|
78
|
+
return path.path.to_s
|
79
|
+
else
|
80
|
+
raise "Paperclip path does not start with public path: #{path.path}" unless path.path.to_s.start_with?(Rails.public_path.to_s)
|
81
|
+
path_without_public = path.path.to_s.gsub("#{Rails.public_path}/", "")
|
82
|
+
raise "Path didn't change '#{path.path}' - '#{path_without_public}'." if path.path.to_s == path_without_public
|
83
|
+
return path_without_public
|
84
|
+
end
|
80
85
|
elsif path.is_a?(String)
|
81
86
|
return path
|
82
87
|
else
|
data/lib/rails_imager/version.rb
CHANGED