Sha256: 93829c8a57229f0c4e8e7062b79c0ab8959cb475aeb8f5f9adde2fa9e6556d22

Contents?: true

Size: 635 Bytes

Versions: 3

Compression:

Stored size: 635 Bytes

Contents

module Appstats
  class Action < ActiveRecord::Base
    self.table_name = "appstats_actions"
    establish_connection "appstats_#{Rails.env}" if configurations.keys.include?("appstats_#{Rails.env}")
    
    attr_accessible :name, :plural_name, :status

    def self.update_actions
      sql = "select distinct(action) from appstats_entries where action not in (select name from appstats_actions)"
      count = 0
      Appstats.connection.execute(sql).each do |row| 
        Appstats::Action.create(:name => row[0], :plural_name => row[0].pluralize, :status => 'derived')
        count += 1
      end
      count
    end
  
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
appstats-0.25.1 lib/appstats/action.rb
appstats-0.25.0 lib/appstats/action.rb
appstats-0.24.0 lib/appstats/action.rb