Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def show
- @post = Post.find(params[:id])
- @author = Author.find(@post.author_id)
- @votes = Vote.find_by(post_id: params[:id])
- @score = 0
- @votes.each do |vote|
- if vote.vote_type == 0
- @score += 1
- else
- @score -= 1
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement