Forked from
PortalMEC / portalmec
1507 commits behind the upstream repository.
-
Mauricio Giacomini Girardello authoredMauricio Giacomini Girardello authored
bookmark.rb 578 B
# == Schema Information
#
# Table name: bookmarks
#
# id :integer not null, primary key
# user_id :integer
# bookmarkable_id :integer
# bookmarkable_type :string
# created_at :datetime not null
# updated_at :datetime not null
#
class Bookmark < ActiveRecord::Base
include Trackable
belongs_to :user, counter_cache: true
belongs_to :bookmarkable, polymorphic: true
validates_presence_of :user, :bookmarkable
validates :user_id, uniqueness: { scope: [:bookmarkable_id, :bookmarkable_type] }
end