Skip to content

Commit

Permalink
add access statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
Emiko committed Sep 10, 2013
1 parent a17b5cb commit 207b3e8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.bundle
log/*.log
tmp/**/*
solr/data/*

2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ source "http://rubygems.org"
gemspec

# jquery-rails is used by the dummy application
gem "jquery-rails"

# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
Expand Down
5 changes: 5 additions & 0 deletions app/models/ndl_stat_access.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class NdlStatAccess < ActiveRecord::Base
belongs_to :ndl_statistic

validates_presence_of :log_type, :internal
end
1 change: 1 addition & 0 deletions app/models/ndl_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class NdlStatistic < ActiveRecord::Base
has_many :ndl_stat_manifestations, :dependent => :destroy
has_many :ndl_stat_accepts, :dependent => :destroy
has_many :ndl_stat_checkouts, :dependent => :destroy
has_many :ndl_stat_accesses, :dependent => :destroy
attr_accessible :term_id

term_ids = Term.select(:id).map(&:id)
Expand Down
14 changes: 14 additions & 0 deletions db/migrate/20130828091400_create_ndl_stat_accesses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class CreateNdlStatAccesses < ActiveRecord::Migration
def change
create_table :ndl_stat_accesses do |t|
t.string :log_type, :null => false
t.boolean :internal, :null => false
t.integer :count, :null => false
t.references :ndl_statistic, :null => false

t.timestamps
end
add_index :ndl_stat_accesses, :ndl_statistic_id
end

end

0 comments on commit 207b3e8

Please sign in to comment.