Class: BlogComment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- BlogComment
show all
- Defined in:
- app/models/blog_comment.rb
Defined Under Namespace
Modules: Moderation, Notification
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.toggle! ⇒ Object
49
50
51
52
53
54
|
# File 'app/models/blog_comment.rb', line 49
def self.toggle!
currently = RefinerySetting.find_or_set(:comments_allowed, true, {
:scoping => 'blog'
})
RefinerySetting.set(:comments_allowed, {:value => !currently, :scoping => 'blog'})
end
|
Instance Method Details
#approve! ⇒ Object
29
30
31
|
# File 'app/models/blog_comment.rb', line 29
def approve!
self.update_attribute(:state, 'approved')
end
|
#approved? ⇒ Boolean
41
42
43
|
# File 'app/models/blog_comment.rb', line 41
def approved?
self.state == 'approved'
end
|
#avatar_url(options = {}) ⇒ Object
22
23
24
25
26
27
|
# File 'app/models/blog_comment.rb', line 22
def avatar_url(options = {})
options = {:size => 60}
require 'digest/md5'
size = ("?s=#{options[:size]}" if options[:size])
"http://gravatar.com/avatar/#{Digest::MD5.hexdigest(self.email.to_s.strip.downcase)}#{size}.jpg"
end
|
#reject! ⇒ Object
33
34
35
|
# File 'app/models/blog_comment.rb', line 33
def reject!
self.update_attribute(:state, 'rejected')
end
|
#rejected? ⇒ Boolean
37
38
39
|
# File 'app/models/blog_comment.rb', line 37
def rejected?
self.state == 'rejected'
end
|
#unmoderated? ⇒ Boolean
45
46
47
|
# File 'app/models/blog_comment.rb', line 45
def unmoderated?
self.state.nil?
end
|