Sha256: 3f8806df3c373e27e8180c7f31d964bddac789abcc0087f82ab8cb05fa416c41
Contents?: true
Size: 555 Bytes
Versions: 1
Compression:
Stored size: 555 Bytes
Contents
require "active_record" module Carrierwave module Base64 module ActiveRecord def mount_base64_uploader(attribute, uploader_class) mount_uploader attribute, uploader_class define_method "#{attribute}=" do |data| if data.present? && data.is_a?(String) && data.strip.start_with?("data:image") super(Carrierwave::Base64::Base64StringIO.new(data.strip)) else super(data) end end end end end end ActiveRecord::Base.extend Carrierwave::Base64::ActiveRecord
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
carrierwave-base64-1.3 | lib/carrierwave/base64/orm/activerecord.rb |