You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
559 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: rules
  5. #
  6. # id :bigint(8) not null, primary key
  7. # priority :integer default(0), not null
  8. # deleted_at :datetime
  9. # text :text default(""), not null
  10. # created_at :datetime not null
  11. # updated_at :datetime not null
  12. #
  13. class Rule < ApplicationRecord
  14. include Discard::Model
  15. self.discard_column = :deleted_at
  16. validates :text, presence: true, length: { maximum: 300 }
  17. scope :ordered, -> { kept.order(priority: :asc) }
  18. end