pothoven-attachment_fu 3.2.10 → 3.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/lib/pothoven-attachment_fu.rb +23 -8
- data/lib/technoweenie/attachment_fu.rb +8 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,12 +1,27 @@
|
|
1
|
-
class Engine < Rails::Engine
|
2
|
-
# Mimic old vendored plugin behavior, attachment_fu/lib is autoloaded.
|
3
|
-
config.autoload_paths << File.expand_path("..", __FILE__)
|
4
1
|
|
5
|
-
|
6
|
-
|
2
|
+
if defined?(Rails::Engine)
|
3
|
+
# Rails >= 3
|
4
|
+
class Engine < Rails::Engine
|
5
|
+
# Mimic old vendored plugin behavior, attachment_fu/lib is autoloaded.
|
6
|
+
config.autoload_paths << File.expand_path("..", __FILE__)
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
initializer "attachment_fu" do
|
9
|
+
require 'geometry'
|
10
|
+
|
11
|
+
ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
|
12
|
+
Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
|
13
|
+
FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
|
14
|
+
end
|
11
15
|
end
|
16
|
+
else
|
17
|
+
# Rails <= 2
|
18
|
+
require 'geometry'
|
19
|
+
|
20
|
+
ActiveSupport::Dependencies.autoload_paths << File.expand_path("..", __FILE__)
|
21
|
+
|
22
|
+
ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
|
23
|
+
Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
|
24
|
+
FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
|
25
|
+
|
26
|
+
$:.unshift(File.expand_path("../vendor", __FILE__))
|
12
27
|
end
|
@@ -319,11 +319,17 @@ module Technoweenie # :nodoc:
|
|
319
319
|
thumbnailable? || raise(ThumbnailError.new("Can't create a thumbnail if the content type is not an image or there is no parent_id column"))
|
320
320
|
find_or_initialize_thumbnail(file_name_suffix).tap do |thumb|
|
321
321
|
thumb.temp_paths.unshift temp_file
|
322
|
-
|
322
|
+
assign_attributes_args = []
|
323
|
+
assign_attributes_args << {
|
323
324
|
:content_type => content_type,
|
324
325
|
:filename => thumbnail_name_for(file_name_suffix),
|
325
326
|
:thumbnail_resize_options => size
|
326
|
-
}
|
327
|
+
}
|
328
|
+
if defined?(Rails) && Rails::VERSION::MAJOR >= 3
|
329
|
+
# assign_attributes API in Rails 2.3 doesn't take a second argument
|
330
|
+
assign_attributes_args << { :without_protection => true }
|
331
|
+
end
|
332
|
+
thumb.send(:assign_attributes, *assign_attributes_args)
|
327
333
|
callback_with_args :before_thumbnail_saved, thumb
|
328
334
|
thumb.save!
|
329
335
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pothoven-attachment_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: This is a fork of Rick Olson's attachment_fu adding Ruby 1.9 and Rails
|
16
16
|
3.2 support as well as some other enhancements.
|