Sha256: 889e613208459a072594854c6e0038b7f4a4494d31164f3d456400227ccd6459
Contents?: true
Size: 1.01 KB
Versions: 10
Compression:
Stored size: 1.01 KB
Contents
module FlexibleFeeds class Feed < ActiveRecord::Base include FlexibleFeeds::PolymorphicJoin belongs_to :feedable, polymorphic: true has_many :event_joins, dependent: :destroy has_many :events, through: :event_joins has_many :follows, dependent: :destroy has_many :moderator_joins, dependent: :destroy polymorphically_joined_through :moderator_joins, association_name: :moderators, singular_association_name: :moderator polymorphically_joined_through :follows, association_name: :followers, singular_association_name: :follower validate :unique_name_per_feedable private def unique_name_per_feedable if feedable.present? && feedable.respond_to?(:feeds) && feedable.feed_named(self.name).present? errors[:base] << I18n.t("activerecord.errors.models.feed.attributes.name.not_unique") end end end end
Version data entries
10 entries across 10 versions & 1 rubygems