2014-03-26 11:09:39 +00:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: view_counts
|
|
|
|
#
|
|
|
|
# id :integer not null, primary key
|
|
|
|
# ip_address :string(255)
|
|
|
|
# logged_in :boolean
|
2020-03-18 03:38:17 +00:00
|
|
|
# viewable_type :string(255)
|
2014-03-26 11:09:39 +00:00
|
|
|
# created_at :date
|
2020-03-18 03:38:17 +00:00
|
|
|
# viewable_id :integer
|
|
|
|
#
|
|
|
|
# Indexes
|
|
|
|
#
|
|
|
|
# index_view_counts_on_viewable_type_and_viewable_id (viewable_type,viewable_id)
|
2014-03-26 11:09:39 +00:00
|
|
|
#
|
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
class ViewCount < ActiveRecord::Base
|
2020-03-26 02:26:30 +00:00
|
|
|
belongs_to :viewable, :polymorphic => true, :optional => true
|
2014-03-23 00:22:25 +00:00
|
|
|
validates_uniqueness_of :ip_address, :scope => [ :viewable_id, :viewable_type ]
|
|
|
|
end
|