Sha256: 144078236babf05a21e2842e7a593ec0cccc3630b60129e047a5f5980884982e

Contents?: true

Size: 632 Bytes

Versions: 10

Compression:

Stored size: 632 Bytes

Contents

module Appstats
  class Action < ActiveRecord::Base
    set_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

10 entries across 10 versions & 1 rubygems

Version Path
appstats-0.23.5 lib/appstats/action.rb
appstats-0.23.4 lib/appstats/action.rb
appstats-0.23.3 lib/appstats/action.rb
appstats-0.23.2 lib/appstats/action.rb
appstats-0.23.1 lib/appstats/action.rb
appstats-0.23.0 lib/appstats/action.rb
appstats-0.22.6 lib/appstats/action.rb
appstats-0.22.5 lib/appstats/action.rb
appstats-0.22.4 lib/appstats/action.rb
appstats-0.22.3 lib/appstats/action.rb