class DesignFile include Mongoid::Document include Mongoid::Timestamps mount_uploader :file, AssetUploader field :name before_save :set_name protected def set_name self.name = self.file_identifier end end