pothoven-attachment_fu 3.2.10 → 3.2.11

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.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ * Jan 7, 2014 *
2
+ * Pull in changes from twelvelabs to fix gem use in Rails 2
3
+
1
4
  * Aug 22, 2013 *
2
5
  * Added cache-control header option and Ruby 1.9 fix for S3 from tricycle
3
6
 
@@ -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
- initializer "attachment_fu" do
6
- require 'geometry'
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
- ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods)
9
- Technoweenie::AttachmentFu.tempfile_path = ATTACHMENT_FU_TEMPFILE_PATH if Object.const_defined?(:ATTACHMENT_FU_TEMPFILE_PATH)
10
- FileUtils.mkdir_p Technoweenie::AttachmentFu.tempfile_path
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
- thumb.send(:assign_attributes, {
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
- }, :without_protection => true)
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.10
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: 2013-08-22 00:00:00.000000000 Z
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.