Module: SubjModels::NomenclatureReviewModule

Defined in:
lib/subj_models/nomenclature_review.rb

Class Method Summary collapse

Class Method Details

.included(including_class) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/subj_models/nomenclature_review.rb', line 7

def self.included(including_class)

  including_class.class_eval do

    include SubjModels::ComprisingExternalId

    after_create :notify

    belongs_to :nomenclature
    belongs_to :user

    validates :user, :nomenclature, :content, presence: true

    scope :nomenclature_id, -> nomenclature { where(nomenclature_id: nomenclature) }

    scope :approved, -> { where(review_approved: true) }

    scope :without_approves, -> { where(review_approved: false) }

  end

end