Sha256: 8254a7e1f993fa747bc01fa1fb762619fb665e9e2f4bbc76f0dd810aa9848bce

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 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
      ActiveRecord::Base.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

2 entries across 2 versions & 1 rubygems

Version Path
appstats-0.22.2 lib/appstats/action.rb
appstats-0.22.1 lib/appstats/action.rb