Sha256: 4437c7df357ce2b510813445a4d6c6c5a1ae16ca9244048ca21da682090ab26a

Contents?: true

Size: 806 Bytes

Versions: 36

Compression:

Stored size: 806 Bytes

Contents

require 'subj_models/concerns/comprising_external_id'

module SubjModels

  module UserSpecializationModule

    def self.included(including_class)

      including_class.class_eval do

        include SubjModels::ComprisingExternalId

        has_and_belongs_to_many :users
        has_and_belongs_to_many :access_groups
        has_and_belongs_to_many :events

        has_many :specialist_activity_document_types, dependent: :destroy
        has_many :user_specialization_approvals, dependent: :destroy
        has_many :nomenclatures

        validates :name, presence: true


        scope :user_id, -> (user_id) { parent_id_scope("user", user_id) }

        scope :unavailable_for_current_user, -> ids { where.not(id: ids) }

      end

      def to_s
        name.to_s
      end

    end

  end

end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
subj_sub_models-0.0.3.16 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.15 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.14 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.13 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.12 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.11 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.10 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.9 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.8 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.7 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.6 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.5 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.4 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.3 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3.1 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.3 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.2 lib/subj_models/user_specialization.rb
subj_sub_models-0.0.1 lib/subj_models/user_specialization.rb
subj_models-0.6.9 lib/subj_models/user_specialization.rb
subj_models-0.6.8 lib/subj_models/user_specialization.rb