Sha256: 2e3768ab4ab2caeea79e6902c06623deb686dda2084b49cc618e59719f21bf9c
Contents?: true
Size: 893 Bytes
Versions: 6
Compression:
Stored size: 893 Bytes
Contents
class Cms::File < ActiveRecord::Base ComfortableMexicanSofa.establish_connection(self) 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