lib/refile/rails/attachment_helper.rb in leifcr-refile-0.6.3 vs lib/refile/rails/attachment_helper.rb in leifcr-refile-0.7.0

- old
+ new

@@ -104,13 +104,16 @@ # @return [ActiveSupport::SafeBuffer] The generated hidden form field def attachment_cache_field(object_name, method, object:, **options) options[:data] ||= {} options[:data][:reference] ||= SecureRandom.hex + attacher_value = object.send("#{method}_data") + hidden_options = { multiple: options[:multiple], - value: object.send("#{method}_data").try(:to_json), + value: attacher_value.try(:to_json), object: object, + disabled: attacher_value.blank?, id: nil, data: { reference: options[:data][:reference] } } hidden_options.merge!(index: options[:index]) if options.key?(:index)