Sha256: bb19ecff9b0cd326651fb0303f02df843b3b9c59d9c05437486a3d423d2596e2
Contents?: true
Size: 775 Bytes
Versions: 8
Compression:
Stored size: 775 Bytes
Contents
module RocketCMS module Models module Mongoid module EmbeddedGalleryImage extend ActiveSupport::Concern include ::Mongoid::Paperclip included do #embedded_in :model # need to override include EmbeddedElement has_mongoid_attached_file :image # need to override def image_file_name=(val) return self[:image_file_name] = "" if val == "" return self[:image_file_name] = nil if val == nil val = val.to_s extension = File.extname(val)[1..-1] file_name = val[0..val.size-extension.size-1] self[:image_file_name] = "#{file_name.filename_to_slug}.#{extension.filename_to_slug}" end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems