-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathcomment.rb
32 lines (28 loc) · 1.15 KB
/
comment.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class Comment < ActiveRecord::Base
include TheComments::Comment
# ---------------------------------------------------
# Define comment's avatar url
# Usually we use Comment#user (owner of comment) to define avatar
# @blog.comments.includes(:user) <= use includes(:user) to decrease queries count
# comment#user.avatar_url
# ---------------------------------------------------
# ---------------------------------------------------
# Simple way to define avatar url
# def avatar_url
# hash = Digest::MD5.hexdigest self.id.to_s
# "http://www.gravatar.com/avatar/#{hash}?s=30&d=identicon"
# end
# ---------------------------------------------------
# ---------------------------------------------------
# Define your filters for content
# Expample for: gem 'RedCloth', gem 'sanitize'
# your personal SmilesProcessor
# def prepare_content
# text = self.raw_content
# text = RedCloth.new(text).to_html
# text = SmilesProcessor.new(text)
# text = Sanitize.clean(text, Sanitize::Config::RELAXED)
# self.content = text
# end
# ---------------------------------------------------
end