Sha256: e368fda3569e948d4f549e97c8697d2506daceabbcd32c8b42acae64a78929c7

Contents?: true

Size: 818 Bytes

Versions: 11

Compression:

Stored size: 818 Bytes

Contents

##
# Score Item Tempalte 是评分项模版。
# #sheet 是评分表模版。
# #scorings 是评分项。

class Unidom::Score::ScoreItemTemplate < Unidom::Score::ApplicationRecord

  self.table_name = 'unidom_score_item_templates'

  include Unidom::Common::Concerns::ModelExtension

  validates :title, presence: true, length: { in: 2..columns_hash['title'].limit }
  validates :score, presence: true, numericality: { greater_than_or_equal_to: -1_000_000_000, less_than_or_equal_to: 1_000_000_000 }

  belongs_to :sheet, class_name: 'Unidom::Score::ScoreSheetTemplate'

  has_many :scorings, class_name: 'Unidom::Score::ScoreItem', foreign_key: :template_id

  scope :sheet_is, ->(sheet) { where sheet_id: to_id(sheet) }

end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Score::ScoreItemTemplate'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unidom-score-2.0 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.8 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.7 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.6 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.5 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.4 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.3 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.2 app/models/unidom/score/score_item_template.rb
unidom-score-1.1.1 app/models/unidom/score/score_item_template.rb
unidom-score-1.1 app/models/unidom/score/score_item_template.rb
unidom-score-1.0.2 app/models/unidom/score/score_item_template.rb