Sha256: cd02b7f764c24ef009f1d6340270a585cb158639a88b4871171ca25b0efe2a15

Contents?: true

Size: 576 Bytes

Versions: 10

Compression:

Stored size: 576 Bytes

Contents

module Appstats
  class Host < ActiveRecord::Base
    set_table_name "appstats_hosts"
    establish_connection "appstats_#{Rails.env}" if configurations.keys.include?("appstats_#{Rails.env}")
    
    attr_accessible :name, :status

    def self.update_hosts
      sql = "select distinct(host) from appstats_log_collectors where host not in (select name from appstats_hosts)"
      count = 0
      Appstats.connection.execute(sql).each do |row| 
        Appstats::Host.create(:name => row[0], :status => 'derived')
        count += 1
      end
      count
    end
  
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
appstats-0.23.5 lib/appstats/host.rb
appstats-0.23.4 lib/appstats/host.rb
appstats-0.23.3 lib/appstats/host.rb
appstats-0.23.2 lib/appstats/host.rb
appstats-0.23.1 lib/appstats/host.rb
appstats-0.23.0 lib/appstats/host.rb
appstats-0.22.6 lib/appstats/host.rb
appstats-0.22.5 lib/appstats/host.rb
appstats-0.22.4 lib/appstats/host.rb
appstats-0.22.3 lib/appstats/host.rb