Newer
Older
# == Schema Information
#
# Table name: follows
#
# id :integer not null, primary key
# followable_id :integer
# followable_type :string
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
# *current_user* follows *followable*
belongs_to :followable, polymorphic: true, counter_cache: true
validates_presence_of :user, :followable
validates :user_id, uniqueness: { scope: [:followable_id, :followable_type] }