Sha256: d3df0350211bc31056359ef2c2f12264cff0cdd8861b31f9e5249dccfce97939
Contents?: true
Size: 615 Bytes
Versions: 53
Compression:
Stored size: 615 Bytes
Contents
# frozen_string_literal: true module Decidim # Store user's social identities class Identity < ApplicationRecord belongs_to :user, foreign_key: :decidim_user_id, class_name: "Decidim::User" belongs_to :organization, foreign_key: :decidim_organization_id, class_name: "Decidim::Organization" validates :provider, presence: true validates :uid, presence: true, uniqueness: { scope: [:provider, :organization] } validate :same_organization private def same_organization return if organization == user&.organization errors.add(:organization, :invalid) end end end
Version data entries
53 entries across 53 versions & 2 rubygems