Sha256: 0f77cdf0369a9e530f3bf87720bcf5067951c18cfc106a55978e950df3c154e0

Contents?: true

Size: 586 Bytes

Versions: 2

Compression:

Stored size: 586 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
      ActiveRecord::Base.connection.execute(sql).each do |row| 
        Appstats::Host.create(:name => row[0], :status => 'derived')
        count += 1
      end
      count
    end
  
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
appstats-0.22.2 lib/appstats/host.rb
appstats-0.22.1 lib/appstats/host.rb