Anexos aninhados

This commit is contained in:
2008-04-22 12:02:51 -03:00
parent 0695c44b21
commit ba62ba336c
10 changed files with 80 additions and 7 deletions

View File

@@ -49,6 +49,8 @@ class Attachment < ActiveRecord::Base
# modificar a descrição, ou algo assim..
errors.add("file", "is needed"[]) if not self.id
end
errors.add("path", "muito longo") if !@path.nil? and @path.split('/').size > 10
end
# Salva o arquivo fisicamente no HD
@@ -69,4 +71,5 @@ class Attachment < ActiveRecord::Base
# @file_path = "#{RAILS_ROOT}/public/upload/#{course.id}/#{self.id}"
# File.delete(@file_path) if File.exists?(@file_path)
#end
end

View File

@@ -21,7 +21,7 @@ class Course < ActiveRecord::Base
# Associacoes
has_many :attachments,
:order => "file_name",
:order => "path, file_name",
:dependent => :destroy
has_many :events,