Sha256: fa31243e633693260bb10b70dc68ee9ec3099fcf2744d166d4fd1e7c6053aa88
Contents?: true
Size: 1 KB
Versions: 30
Compression:
Stored size: 1 KB
Contents
module ActiveScaffold module Bridges class Paperclip module PaperclipBridge def initialize(model_id) super return unless model.respond_to?(:attachment_definitions) && !model.attachment_definitions.nil? update.multipart = true create.multipart = true model.attachment_definitions.each_key do |field| configure_paperclip_field(field.to_sym) # define the "delete" helper for use with active scaffold, unless it's already defined ActiveScaffold::Bridges::Paperclip::PaperclipBridgeHelpers.generate_delete_helper(model, field) end end private def configure_paperclip_field(field) columns << field columns[field].form_ui ||= :paperclip columns[field].params.add "delete_#{field}" %i[file_name content_type file_size updated_at].each do |f| columns.exclude("#{field}_#{f}".to_sym) end end end end end end
Version data entries
30 entries across 30 versions & 1 rubygems