Skip to content

Instantly share code, notes, and snippets.

@ckib16
Created March 2, 2015 22:35
Show Gist options
  • Save ckib16/8b1d1a7cdd4fed17b8ad to your computer and use it in GitHub Desktop.
Save ckib16/8b1d1a7cdd4fed17b8ad to your computer and use it in GitHub Desktop.
Stuck on bookmark_id
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
has_many :topics, dependent: :destroy
has_many :bookmarks, through: :topics, dependent: :destroy
has_many :likes, dependent: :destroy
def liked(post)
likes.where(bookmark_id: bookmark_id).first
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment