Class: BcmsBlog::BlogComment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- BcmsBlog::BlogComment
- Defined in:
- app/models/bcms_blog/blog_comment.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.columns_for_index ⇒ Object
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_order ⇒ Object
14 15 16 |
# File 'app/models/bcms_blog/blog_comment.rb', line 14 def self.default_order "created_at desc" end |
.default_order_for_search ⇒ Object
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_at ⇒ Object
31 32 33 |
# File 'app/models/bcms_blog/blog_comment.rb', line 31 def formatted_created_at created_at.to_s(:date) end |
#name ⇒ Object
27 28 29 |
# File 'app/models/bcms_blog/blog_comment.rb', line 27 def name body ? body[0..50] : "" end |
#publish_if_comments_are_enabled ⇒ Object
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 |