Sha256: df5e218f1f0ec0c431f29f8021c4da01efa58fd85b58ba68e465329d53cf2465
Contents?: true
Size: 836 Bytes
Versions: 6
Compression:
Stored size: 836 Bytes
Contents
class Cms::File < ActiveRecord::Base set_table_name :cms_files cms_is_categorized # -- AR Extensions -------------------------------------------------------- has_attached_file :file, ComfortableMexicanSofa.config.upload_file_options # -- Relationships -------------------------------------------------------- belongs_to :site # -- Validations ---------------------------------------------------------- validates :site_id, :presence => true validates_attachment_presence :file validates_uniqueness_of :file_file_name, :scope => :site_id # -- Callbacks ------------------------------------------------------------ before_save :assign_label protected def assign_label self.label = self.label.blank?? self.file_file_name.gsub(/\.[^\.]*?$/, '').titleize : self.label end end
Version data entries
6 entries across 6 versions & 1 rubygems