model/migration for promoted statuses

This commit is contained in:
2458773093
2019-08-31 00:14:50 +03:00
parent 3b1cfd4253
commit 044e9695fe
3 changed files with 44 additions and 6 deletions

18
app/models/promotion.rb Normal file
View File

@@ -0,0 +1,18 @@
# == Schema Information
#
# Table name: promotions
#
# id :bigint(8) not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# expires_at :datetime
# status_id :bigint(8) not null
# timeline_id :string
# position :integer default(10)
#
class Promotion < ApplicationRecord
belongs_to :status
scope :active, -> { where('expires_at > ?', [Time.now]) }
end