Sha256: 5530d43c106466e2258edc5bd134c1a507f028f922ef884cd7a00c6e7577b9f2
Contents?: true
Size: 858 Bytes
Versions: 19
Compression:
Stored size: 858 Bytes
Contents
module EnjuBookmark module BookmarkManifestation def self.included(base) base.extend ClassMethods end module ClassMethods def enju_bookmark_manifestation_model include InstanceMethods has_many :bookmarks, dependent: :destroy, foreign_key: :manifestation_id has_many :users, through: :bookmarks searchable do string :tag, multiple: true do bookmarks.map{|bookmark| bookmark.tag_list}.flatten end text :tag do bookmarks.map{|bookmark| bookmark.tag_list}.flatten end end end end module InstanceMethods def bookmarked?(user) return true if user.bookmarks.where(url: url).first false end def tags bookmarks.map{|bookmark| bookmark.tags}.flatten end end end end
Version data entries
19 entries across 19 versions & 1 rubygems