Sha256: d7a1486f44e2a4cdf10834e4465a0dd407a1b42da7633092a3dadfa970cf1531

Contents?: true

Size: 440 Bytes

Versions: 60

Compression:

Stored size: 440 Bytes

Contents

# frozen_string_literal: true

module Ibrain
  class RoleUser < Ibrain::Base
    belongs_to :role, class_name: "Ibrain::Role", optional: true
    belongs_to :user, class_name: Ibrain::UserClassHandle.new, optional: true

    after_create :auto_generate_ibrain_api_key

    validates :role_id, uniqueness: { scope: :user_id }

    private

    def auto_generate_ibrain_api_key
      user.try(:auto_generate_ibrain_api_key)
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
ibrain-core-0.5.15 app/models/ibrain/role_user.rb
ibrain-core-0.5.13 app/models/ibrain/role_user.rb
ibrain-core-0.5.12 app/models/ibrain/role_user.rb
ibrain-core-0.5.10 app/models/ibrain/role_user.rb
ibrain-core-0.5.9 app/models/ibrain/role_user.rb
ibrain-core-0.5.8 app/models/ibrain/role_user.rb
ibrain-core-0.5.7 app/models/ibrain/role_user.rb
ibrain-core-0.5.6 app/models/ibrain/role_user.rb
ibrain-core-0.5.5 app/models/ibrain/role_user.rb
ibrain-core-0.5.4 app/models/ibrain/role_user.rb
ibrain-core-0.5.3 app/models/ibrain/role_user.rb
ibrain-core-0.5.2 app/models/ibrain/role_user.rb
ibrain-core-0.5.1 app/models/ibrain/role_user.rb
ibrain-core-0.5.0 app/models/ibrain/role_user.rb
ibrain-core-0.4.9 app/models/ibrain/role_user.rb
ibrain-core-0.4.8 app/models/ibrain/role_user.rb
ibrain-core-0.4.7 app/models/ibrain/role_user.rb
ibrain-core-0.4.5 app/models/ibrain/role_user.rb
ibrain-core-0.4.4 app/models/ibrain/role_user.rb
ibrain-core-0.4.3 app/models/ibrain/role_user.rb