Class: Appstats::ContextKey

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

Class Method Summary collapse

Class Method Details

.update_context_keysObject



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

def self.update_context_keys
  sql = "select distinct(context_key) from appstats_contexts where context_key not in (select name from appstats_context_keys)"
  count = 0
  ActiveRecord::Base.connection.execute(sql).each do |row| 
    Appstats::ContextKey.create(:name => row[0], :status => 'derived')
    count += 1
  end
  count
end