Class: ActiveAdminAddons::PaperclipImageBuilder

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

Instance Attribute Summary

Attributes inherited from CustomBuilder

#args, #block, #context, #model

Instance Method Summary collapse

Methods inherited from CustomBuilder

#initialize, render

Constructor Details

This class inherits a constructor from ActiveAdminAddons::CustomBuilder

Instance Method Details

#renderObject



3
4
5
6
7
8
# File 'lib/activeadmin_addons/addons/paperclip_image.rb', line 3

def render
  return nil if data.nil?
  raise 'you need to pass a paperclip image attribute' unless data.respond_to?(:url)
  style = options.fetch(:style, :original)
  context.image_tag(data.url(style)) if data.exists?
end