Class: Appstats::ContextValue

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/appstats/context_value.rb

Class Method Summary collapse

Class Method Details

.update_context_valuesObject



8
9
10
11
12
13
14
15
16
# File 'lib/appstats/context_value.rb', line 8

def self.update_context_values
  sql = "select distinct(context_value) from appstats_contexts where context_value not in (select name from appstats_context_values)"
  count = 0
  Appstats.connection.execute(sql).each do |row| 
    Appstats::ContextValue.create(:name => row[0], :status => 'derived')
    count += 1
  end
  count
end