Commit caf7b5116ef6ac931e61bc0a562fa5a4440fb202
1 parent
f8dbcc7c
Exists in
master
and in
20 other branches
rails4: update attachment_fu and remove monkey patch
Showing
2 changed files
with
2 additions
and
33 deletions
Show diff stats
Gemfile
... | ... | @@ -11,7 +11,7 @@ gem 'daemons', '~> 1.1.5' |
11 | 11 | gem 'thin', '~> 1.3.1' |
12 | 12 | gem 'nokogiri', '~> 1.6.0' |
13 | 13 | gem 'will_paginate' |
14 | -gem 'pothoven-attachment_fu' | |
14 | +gem 'pothoven-attachment_fu', '~> 3.2.16' | |
15 | 15 | gem 'delayed_job' |
16 | 16 | gem 'delayed_job_active_record' |
17 | 17 | gem 'rake', :require => false |
... | ... | @@ -58,7 +58,7 @@ group :cucumber do |
58 | 58 | gem 'cucumber', '~> 1.3.20' |
59 | 59 | gem 'cucumber-rails', '~> 1.4.2', :require => false |
60 | 60 | gem 'database_cleaner', '~> 1.2.0' |
61 | - gem 'selenium-webdriver', '~> 2.39.0' | |
61 | + gem 'selenium-webdriver' | |
62 | 62 | end |
63 | 63 | |
64 | 64 | # Requires custom dependencies | ... | ... |
vendor/plugins/monkey_patches/attachment_fu/init.rb
... | ... | @@ -26,34 +26,3 @@ Technoweenie::AttachmentFu::Backends::FileSystemBackend.module_eval do |
26 | 26 | end |
27 | 27 | end |
28 | 28 | |
29 | -# https://github.com/pothoven/attachment_fu/pull/14 | |
30 | -# remove on 3.2.16 | |
31 | -Technoweenie::AttachmentFu::InstanceMethods.module_eval do | |
32 | - # Creates or updates the thumbnail for the current attachment. | |
33 | - def create_or_update_thumbnail(temp_file, file_name_suffix, *size) | |
34 | - thumbnailable? || raise(ThumbnailError.new("Can't create a thumbnail if the content type is not an image or there is no parent_id column")) | |
35 | - find_or_initialize_thumbnail(file_name_suffix).tap do |thumb| | |
36 | - thumb.temp_paths.unshift temp_file | |
37 | - attributes = { | |
38 | - content_type: content_type, | |
39 | - filename: thumbnail_name_for(file_name_suffix), | |
40 | - thumbnail_resize_options: size | |
41 | - } | |
42 | - attributes.each{ |a, v| thumb.send "#{a}=", v } | |
43 | - callback_with_args :before_thumbnail_saved, thumb | |
44 | - thumb.save! | |
45 | - end | |
46 | - end | |
47 | - | |
48 | - # Initializes a new thumbnail with the given suffix. | |
49 | - def find_or_initialize_thumbnail(file_name_suffix) | |
50 | - attrs = {thumbnail: file_name_suffix.to_s} | |
51 | - attrs[:parent_id] = id if respond_to? :parent_id | |
52 | - thumb = thumbnail_class.where(attrs).first | |
53 | - unless thumb | |
54 | - thumb = thumbnail_class.new | |
55 | - attrs.each{ |a, v| thumb[a] = v } | |
56 | - end | |
57 | - thumb | |
58 | - end | |
59 | -end | ... | ... |