Class: BcmsBlog::BlogComment

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/bcms_blog/blog_comment.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.columns_for_indexObject



22
23
24
25
# File 'app/models/bcms_blog/blog_comment.rb', line 22

def self.columns_for_index
  [ {:label => "Comment",    :method => :name,                 :order => "body" },
    {:label => "Created At", :method => :formatted_created_at, :order => "created_at"} ]
end

.default_orderObject



14
15
16
# File 'app/models/bcms_blog/blog_comment.rb', line 14

def self.default_order
  "created_at desc"
end

.default_order_for_searchObject



18
19
20
# File 'app/models/bcms_blog/blog_comment.rb', line 18

def self.default_order_for_search
  default_order
end

Instance Method Details

#formatted_created_atObject



31
32
33
# File 'app/models/bcms_blog/blog_comment.rb', line 31

def formatted_created_at
  created_at.to_s(:date)
end

#nameObject



27
28
29
# File 'app/models/bcms_blog/blog_comment.rb', line 27

def name
  body ? body[0..50] : ""
end

#publish_if_comments_are_enabledObject



10
11
12
# File 'app/models/bcms_blog/blog_comment.rb', line 10

def publish_if_comments_are_enabled
  self.published = true unless post.blog.moderate_comments?
end