Sha256: 04fb212e318dae126e45cf288a5c856f044eade9fb658a9c0612376c4aeb2abb
Contents?: true
Size: 1009 Bytes
Versions: 71
Compression:
Stored size: 1009 Bytes
Contents
module ActiveScaffold module Bridges class Dragonfly module DragonflyBridge def initialize_with_dragonfly(model_id) initialize_without_dragonfly(model_id) return unless self.model.respond_to?(:dragonfly_attachment_classes) && self.model.dragonfly_attachment_classes.present? self.update.multipart = true self.create.multipart = true self.model.dragonfly_attachment_classes.each do |attachment| configure_dragonfly_field(attachment.attribute) end end def self.included(base) base.alias_method_chain :initialize, :dragonfly end private def configure_dragonfly_field(field) self.columns << field self.columns[field].form_ui ||= :dragonfly self.columns[field].params.add "remove_#{field}" [:name, :uid].each do |f| self.columns.exclude("#{field}_#{f}".to_sym) end end end end end end
Version data entries
71 entries across 71 versions & 2 rubygems