Sha256: 60968b5a42e5316b6dc176977a6001d53c6d116d1fef49cab497c00a517bef15

Contents?: true

Size: 734 Bytes

Versions: 51

Compression:

Stored size: 734 Bytes

Contents

require 'subj_models/concerns/comprising_external_id'

module SubjModels

  module NomenclatureReviewModule

    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

    private

    def notify
      NomenclatureReviewMailer.notify(self).deliver
    end

  end

end

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
subj_sub_models-0.0.3.29 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.28 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.27 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.26 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.25 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.24 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.23 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.22 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.21 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.20 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.19 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.18 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.17 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.16 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.15 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.14 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.13 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.12 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.11 lib/subj_models/nomenclature_review.rb
subj_sub_models-0.0.3.10 lib/subj_models/nomenclature_review.rb