Anexos aninhados
This commit is contained in:
@@ -50,6 +50,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
|
||||
@@ -70,4 +72,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
|
||||
|
||||
@@ -21,7 +21,7 @@ class Course < ActiveRecord::Base
|
||||
|
||||
# Associacoes
|
||||
has_many :attachments,
|
||||
:order => "file_name",
|
||||
:order => "path, file_name",
|
||||
:dependent => :destroy
|
||||
|
||||
has_many :events,
|
||||
|
||||
Reference in New Issue
Block a user