Sha256: 11c14bf8a1c9af229a771e982cf549f3ba55a072c07e213ab83f90bc9ddce415

Contents?: true

Size: 891 Bytes

Versions: 10

Compression:

Stored size: 891 Bytes

Contents

module Appstats
  class ActionContextKey < ActiveRecord::Base
    set_table_name "appstats_action_context_keys"
    establish_connection "appstats_#{Rails.env}" if configurations.keys.include?("appstats_#{Rails.env}")
    
    attr_accessible :action_name, :context_key, :status
  
    def self.update_action_context_keys
      sql = "select action,context_key,count(*) as num
      from appstats_entries 
      inner join appstats_contexts on appstats_contexts.appstats_entry_id = appstats_entries.id
      where (action,context_key) not in (select action_name, context_key from appstats_action_context_keys)
      group by action,context_key"
      count = 0
      Appstats.connection.execute(sql).each do |row| 
        Appstats::ActionContextKey.create(:action_name => row[0], :context_key => row[1], :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/action_context_key.rb
appstats-0.23.4 lib/appstats/action_context_key.rb
appstats-0.23.3 lib/appstats/action_context_key.rb
appstats-0.23.2 lib/appstats/action_context_key.rb
appstats-0.23.1 lib/appstats/action_context_key.rb
appstats-0.23.0 lib/appstats/action_context_key.rb
appstats-0.22.6 lib/appstats/action_context_key.rb
appstats-0.22.5 lib/appstats/action_context_key.rb
appstats-0.22.4 lib/appstats/action_context_key.rb
appstats-0.22.3 lib/appstats/action_context_key.rb