Sha256: bf33263772c810b5e198d3040f50c35e18374b6a864496ac7cc8545ec3b957a9
Contents?: true
Size: 515 Bytes
Versions: 10
Compression:
Stored size: 515 Bytes
Contents
module FlexibleFeeds class ModeratorJoin < ActiveRecord::Base belongs_to :feed belongs_to :moderator, polymorphic: true validates :feed, presence: true validates :moderator, presence: true validate :the_join_table_is_unique private def the_join_table_is_unique if FlexibleFeeds::ModeratorJoin.where(feed: self.feed, moderator: self.moderator).exists? errors[:base] << I18n.t("activerecord.errors.models.moderator_join.not_unique") end end end end
Version data entries
10 entries across 10 versions & 1 rubygems