All pastes #977887 Raw Edit

Something

public text v1 · immutable
·published 2008-04-09 04:08 UTC
rendered paste body
class LoadLshwOutput < ActiveRecord::Migration
  def self.up
    for report in Report.find(:all)
      file = "/var/www/fgss/lshw_xml/#{system_id.to_s}-#{role_id.to_s}-#{report.created_at.to_date.strftime("%Y-%m-%d-%H%M")}.xml"
      if File.exist?(file)
        fd = File.open(file, 'r')
        report.lshw_output = fd.read
        fd.close
      else
        if report.lshw_output == nil || report.lshw_output == ""
          puts file
        end
      end
    end
  end

  def self.down
    raise "I don't know and I don't care!"
  end
end


=begin
jetty fgss.rb $ rake db:migrate
(in /server/home/ryan52/fgss.rb)
== 2 LoadLshwOutput: migrating ================================================
-- system_id()
rake aborted!
undefined method `system_id' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0xb7698108>

(See full trace by running task with --trace)
jetty fgss.rb $ rake db:migrate --trace
(in /server/home/ryan52/fgss.rb)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== 2 LoadLshwOutput: migrating ================================================
-- system_id()
rake aborted!
undefined method `system_id' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0xb7681c14>
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:285:in `send'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:285:in `method_missing'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:265:in `say_with_time'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:265:in `say_with_time'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:281:in `method_missing'
./db/migrate//002_load_lshw_output.rb:4:in `up_without_benchmarks'
./db/migrate//002_load_lshw_output.rb:3:in `each'
./db/migrate//002_load_lshw_output.rb:3:in `up_without_benchmarks'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:219:in `send'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:219:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:219:in `migrate'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:348:in `migrate'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:339:in `each'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:339:in `migrate'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:307:in `up'
/server/home/ryan52/fgss.rb/vendor/rails/activerecord/lib/active_record/migration.rb:298:in `migrate'
/server/home/ryan52/fgss.rb/vendor/rails/railties/lib/tasks/databases.rake:85
/usr/lib/ruby/1.8/rake.rb:546:in `call'
/usr/lib/ruby/1.8/rake.rb:546:in `execute'
/usr/lib/ruby/1.8/rake.rb:541:in `each'
/usr/lib/ruby/1.8/rake.rb:541:in `execute'
/usr/lib/ruby/1.8/rake.rb:508:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:501:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:501:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:494:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1931:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1909:in `each'
/usr/lib/ruby/1.8/rake.rb:1909:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1903:in `top_level'
/usr/lib/ruby/1.8/rake.rb:1881:in `run'
/usr/lib/ruby/1.8/rake.rb:1948:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1878:in `run'
/usr/bin/rake:28
jetty fgss.rb $ 
=end