Class: ActiveAdminAddons::ImageBuilder

Inherits:
CustomBuilder show all
Defined in:
lib/activeadmin_addons/addons/image_builder.rb

Instance Attribute Summary

Attributes inherited from CustomBuilder

#args, #block, #context, #model

Instance Method Summary collapse

Methods inherited from CustomBuilder

builder_method_name, create_view_methods, #initialize

Constructor Details

This class inherits a constructor from ActiveAdminAddons::CustomBuilder

Instance Method Details

#renderObject



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/activeadmin_addons/addons/image_builder.rb', line 3

def render
  return nil if data.nil?

  if Object.const_defined?('Paperclip::Attachment') && data.is_a?(Paperclip::Attachment)
    paperclip_data
  elsif Object.const_defined?('Shrine::UploadedFile') && data.is_a?(Shrine::UploadedFile)
    shrine_data
  else
    raise "you need to pass a paperclip or shrine image attribute"
  end
end