Sha256: 6bb054c4c34b1c435cc302174fe792fd4e46d70af6ee1846b22b888542f122aa

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 KB

Contents

←   [documentation](documentation.md)

### Comment API

```ruby
@comment = Comment.last

# Comment creator, can be nil (for Guest)
@comment.user # => User

# Comment holder
# Owner of commentable object
# shouldn't be nil, should be defined on create
@comment.holder  # => User

# Commentable object
@comment.commentable # => Post

# Raw user input
@comment.raw_content

# Processed user input
# method *prepare_content* should be redefined by developer
@comment.content

# Denormalization fields
@comment.commentable_title  # => "Harum sint error odit."
@comment.commentable_url    # => "/posts/7"
@comment.commentable_state  # => "published"

# Stat info from request
# Can be used for spam detection
@comment.user_agent       # => Opera/9.80 (Windows NT 5.1; U; en) Presto/2.2.15 Version/10.10 
@comment.tolerance_time   # => 5 (secs)
@comment.referer          # => localhost:3000/post/7
@comment.ip               # => 192.168.0.12

# State
@comment.state # => draft | published | deleted

# Spam flag
@comment.spam # => true

# Alias for *mark_as_spam*
@comment.to_spam

# mark this comment and all descendants as spam/not spam
@comment.mark_as_spam
@comment.mark_as_not_spam

# Comment's creator avatar
# this method can be redefined by developer
@comment.avatar_url # => "https://2.gravatar.com/avatar/015e ... 2f05?s=42&d=https://identicons.github.com/AVATAR.png" 

# Anchor of comment
# this method can be redefined by developer
@comment.anchor # => b58020
```

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
fuck_comments-2.3.4 docs/comment_api.md
the_comments_ruby-2.3.4 docs/comment_api.md
the_comments_ruby-2.3.3 docs/comment_api.md
the_comments-2.3.1 docs/comment_api.md
the_comments-2.2.2 docs/comment_api.md
the_comments-2.2.1 docs/comment_api.md
the_comments-2.2.0 docs/comment_api.md
the_comments-2.1.0 docs/comment_api.md
the_comments-2.0.1 docs/comment_api.md
the_comments-2.0.0 docs/comment_api.md