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