Sha256: d55c9a8917ae3ea702fa7586ef2dc28b8e5cbfc4cf3f06c34e06a92244c246cb
Contents?: true
Size: 813 Bytes
Versions: 10
Compression:
Stored size: 813 Bytes
Contents
module RocketCMS module Models module Mongoid module Gallery extend ActiveSupport::Concern include ::Mongoid::Paperclip included do manual_slug :name acts_as_nested_set scope :sorted, -> { order_by([:lft, :asc]) } has_mongoid_attached_file :image # need to override validates_attachment :image, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] } def image_file_name=(val) val = val.to_s return if val.blank? 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
10 entries across 10 versions & 1 rubygems