Sha256: 210899eb61fd77b03766db64adf8357125814af20a6b57d0143bebe3bc47e780
Contents?: true
Size: 735 Bytes
Versions: 29
Compression:
Stored size: 735 Bytes
Contents
module ActiveAdminAddons class PaperclipImageBuilder < CustomBuilder 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 end module ::ActiveAdmin module Views class TableFor def image_column(*args, &block) column(*args) { |model| PaperclipImageBuilder.render(self, model, *args, &block) } end end class AttributesTable def image_row(*args, &block) row(*args) { |model| PaperclipImageBuilder.render(self, model, *args, &block) } end end end end end
Version data entries
29 entries across 29 versions & 1 rubygems