app/models/run.rb
# AttachedFiles 
# Link Method ( By Toshy Namimatsu)
AttachedFiles
Link Method ( By Toshy Namimatsu)
AttachedFiles Link Method ( By Toshy Namimatsu )
def attached_files_connection(checksums,time="base")
    checksums or return false
    cond = "checksum = '" + checksums.join("' or checksum = '") + "'"
    a = AttachedFile.find(:all,:scope=>":self",:conditions=>cond)
    AttachedFile.transaction do 
      a.each do |aa|
        since = aa.since
        since = self.since if time=="self"
        t = aa.attributes
        t[:file_attachable_run_id]=self.run_id
        t[:file_attachable_type]=self.class.to_s
        aa.update_run!(since, t)
      end
      ActiveRecord::Base.connection.execute("DELETE FROM attached_files where file_attachable_run_id=#{self.run_id} and file_attachable_type='#{self.class.to_s}' and checksum IS NULL")
    end
  end
def attached_files_connection ( checksums , time = "base" ) checksums or return false cond = "checksum = '" + checksums . join ( "' or checksum = '" ) + "'" a = AttachedFile . find ( :all , :scope => ":self" , :conditions => cond ) AttachedFile . transaction do a . each do | aa | since = aa . since since = self . since if time == "self" t = aa . attributes t [ :file_attachable_run_id ] = self . run_id t [ :file_attachable_type ] = self . class . to_s aa . update_run! ( since , t ) end ActiveRecord :: Base . connection . execute ( "DELETE FROM attached_files where file_attachable_run_id=#{self.run_id} and file_attachable_type='#{self.class.to_s}' and checksum IS NULL" ) end end
AttachedFiles
Link Method ( By Toshy Namimatsu)
AttachedFiles Link Method ( By Toshy Namimatsu )
checksums
<not_specific>
time
<not_specific>