Commit 4bd4a80dfc345f8b3aa8a529932d74d233935ed7
Exists in
staging
and in
2 other branches
Merge branch 'fix_upload_files_on_development_environment' into 'master'
add patch methods to prepare callback Add patch methods to prepare callback on development mode to make delayed job works properly See merge request !845
Showing
1 changed file
with
18 additions
and
17 deletions
Show diff stats
vendor/plugins/monkey_patches/attachment_fu/init.rb
| @@ -3,26 +3,27 @@ | @@ -3,26 +3,27 @@ | ||
| 3 | 3 | ||
| 4 | require_dependency 'technoweenie/attachment_fu' | 4 | require_dependency 'technoweenie/attachment_fu' |
| 5 | 5 | ||
| 6 | -Technoweenie::AttachmentFu::InstanceMethods.module_eval do | ||
| 7 | - def thumbnailable? | ||
| 8 | - image? && !is_thumbnail? | ||
| 9 | - end | 6 | +ActionDispatch::Reloader.to_prepare do |
| 7 | + Technoweenie::AttachmentFu::InstanceMethods.module_eval do | ||
| 8 | + def thumbnailable? | ||
| 9 | + image? && !is_thumbnail? | ||
| 10 | + end | ||
| 10 | 11 | ||
| 11 | - def is_thumbnail? | ||
| 12 | - (thumbnail_class == self.class) && !(respond_to?(:parent_id) && parent_id.nil?) | 12 | + def is_thumbnail? |
| 13 | + (thumbnail_class == self.class) && !(respond_to?(:parent_id) && parent_id.nil?) | ||
| 14 | + end | ||
| 13 | end | 15 | end |
| 14 | -end | ||
| 15 | 16 | ||
| 16 | -# Monkey patch to rewrite attachment_fu's logic where no image with parent can | ||
| 17 | -# be thumbnailable and supposition that full_filename will return a String | ||
| 18 | -# while it might return Pathname. | ||
| 19 | -Technoweenie::AttachmentFu::Backends::FileSystemBackend.module_eval do | ||
| 20 | - def attachment_path_id | ||
| 21 | - (is_thumbnail? && respond_to?(:parent_id)) ? parent_id : id | ||
| 22 | - end | 17 | + # Monkey patch to rewrite attachment_fu's logic where no image with parent can |
| 18 | + # be thumbnailable and supposition that full_filename will return a String | ||
| 19 | + # while it might return Pathname. | ||
| 20 | + Technoweenie::AttachmentFu::Backends::FileSystemBackend.module_eval do | ||
| 21 | + def attachment_path_id | ||
| 22 | + (is_thumbnail? && respond_to?(:parent_id)) ? parent_id : id | ||
| 23 | + end | ||
| 23 | 24 | ||
| 24 | - def public_filename(thumbnail = nil) | ||
| 25 | - full_filename(thumbnail).to_s.gsub %r(^#{Regexp.escape(base_path)}), '' | 25 | + def public_filename(thumbnail = nil) |
| 26 | + full_filename(thumbnail).to_s.gsub %r(^#{Regexp.escape(base_path)}), '' | ||
| 27 | + end | ||
| 26 | end | 28 | end |
| 27 | end | 29 | end |
| 28 | - |