개념적으로 둘 다 동일합니다. 사용자 likes
게시물과 사용자 bookmarks
님이 게시물을 +1하고 북마크 카운터를 +1합니다.
다음 (사용 범위)처럼 사용할 수 있습니다
class User < ActiveRecord::Base
acts_as_voter
has_many :posts
end
class Post < ActiveRecord::Base
acts_as_votable
belongs_to :user
end
# To like, bookmark a post by a user
@user.likes @post, vote_scope: 'like'
@user.likes @post, vote_scope: 'bookmark'
# Check if a user has liked or bookmarked a post
@user.voted_for? @post, vote_scope: 'like'
@user.voted_for? @post, vote_scope: 'bookmark'
# See a list of user likes and bookmarks
@user.find_voted_items(vote_scope: 'like')
@user.find_voted_items(vote_scope: 'bookmark')
을해야한다고. https://github.com/ryanto/acts_as_votable에 포괄적 인 예가 있습니다.
Amaazzzinggg! 감사! – gitastic