31 lines
599 B
Ruby
31 lines
599 B
Ruby
|
# == Schema Information
|
||
|
#
|
||
|
# Table name: totals
|
||
|
#
|
||
|
# id :integer not null, primary key
|
||
|
# count :integer default(0), not null
|
||
|
# name :text not null
|
||
|
# created_at :datetime not null
|
||
|
# updated_at :datetime not null
|
||
|
#
|
||
|
# Indexes
|
||
|
#
|
||
|
# index_totals_on_name (name)
|
||
|
#
|
||
|
class Total < ApplicationRecord
|
||
|
validates_uniqueness_of :name
|
||
|
validates_length_of :name, in: 1..32
|
||
|
|
||
|
after_save do
|
||
|
CountChannel.create(self)
|
||
|
end
|
||
|
|
||
|
after_update do
|
||
|
CountChannel.update(self)
|
||
|
end
|
||
|
|
||
|
after_destroy do
|
||
|
CountChannel.destroy(self)
|
||
|
end
|
||
|
end
|