From caf7b5116ef6ac931e61bc0a562fa5a4440fb202 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Sat, 1 Aug 2015 19:33:42 -0300 Subject: [PATCH] rails4: update attachment_fu and remove monkey patch --- Gemfile | 4 ++-- vendor/plugins/monkey_patches/attachment_fu/init.rb | 31 ------------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/Gemfile b/Gemfile index 4b8655e..3fafa89 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ gem 'daemons', '~> 1.1.5' gem 'thin', '~> 1.3.1' gem 'nokogiri', '~> 1.6.0' gem 'will_paginate' -gem 'pothoven-attachment_fu' +gem 'pothoven-attachment_fu', '~> 3.2.16' gem 'delayed_job' gem 'delayed_job_active_record' gem 'rake', :require => false @@ -58,7 +58,7 @@ group :cucumber do gem 'cucumber', '~> 1.3.20' gem 'cucumber-rails', '~> 1.4.2', :require => false gem 'database_cleaner', '~> 1.2.0' - gem 'selenium-webdriver', '~> 2.39.0' + gem 'selenium-webdriver' end # Requires custom dependencies diff --git a/vendor/plugins/monkey_patches/attachment_fu/init.rb b/vendor/plugins/monkey_patches/attachment_fu/init.rb index 212d6aa..dcdf7c3 100644 --- a/vendor/plugins/monkey_patches/attachment_fu/init.rb +++ b/vendor/plugins/monkey_patches/attachment_fu/init.rb @@ -26,34 +26,3 @@ Technoweenie::AttachmentFu::Backends::FileSystemBackend.module_eval do end end -# https://github.com/pothoven/attachment_fu/pull/14 -# remove on 3.2.16 -Technoweenie::AttachmentFu::InstanceMethods.module_eval do - # Creates or updates the thumbnail for the current attachment. - def create_or_update_thumbnail(temp_file, file_name_suffix, *size) - thumbnailable? || raise(ThumbnailError.new("Can't create a thumbnail if the content type is not an image or there is no parent_id column")) - find_or_initialize_thumbnail(file_name_suffix).tap do |thumb| - thumb.temp_paths.unshift temp_file - attributes = { - content_type: content_type, - filename: thumbnail_name_for(file_name_suffix), - thumbnail_resize_options: size - } - attributes.each{ |a, v| thumb.send "#{a}=", v } - callback_with_args :before_thumbnail_saved, thumb - thumb.save! - end - end - - # Initializes a new thumbnail with the given suffix. - def find_or_initialize_thumbnail(file_name_suffix) - attrs = {thumbnail: file_name_suffix.to_s} - attrs[:parent_id] = id if respond_to? :parent_id - thumb = thumbnail_class.where(attrs).first - unless thumb - thumb = thumbnail_class.new - attrs.each{ |a, v| thumb[a] = v } - end - thumb - end -end -- libgit2 0.21.2