Skip to content

kaid/simple_comment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

配置


  class Question < ActiveRecord::Base
    include SimpleComment::Commentable
    simple_comment :after_comment_save => lambda {|comment,question|
      # 如果是针对 question 创建的评论,当评论被创建后,运行这个钩子
    }
  end
class User < ActiveRecord::Base
  include SimpleComment::Commenter

  # 给 User 增加评论的相关方法
  simple_comment_user
end

用法


获得被评论模型的所有评论, 如post:

post.comments

获得评论创建者的所有评论,如user:

user.comments

在模型上添加评论:

post.add_comment user, '评论内容'

获得相关评论创建者评论的scope:

post.comments.with_creator(user)

获得排除相关评论创建者评论的scope:

post.comments.without_creator(user)

About

A flexible attachable comment library for ActiveRecord.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages