Developers

Comment

This is a representation of single comment associated with article. Most usually, there is a array of comments with article.

Availability of comments

Comments can be accessed through article by using {{ article.comments }} variable. This accessor method returns only comments that are in public state (e.g. not spam). Here is an simple example:

{% for comment in article.comments %}
  From: {{ comment.author }} at {{ comment.created_at | date: "%d.%m" }}
  {{ comment.body }}
{% endfor %}

Available properties

These properties give access to extra features on this object.

author

Returns author name for comment.

author_email

Returns author email for comment.

body

Returns formatted body for comment.

created_at

Returns Time object representing comment creation time.

errors

Returns an array of possible validation errors. Useful when rendering a comment form.

valid?

Returns true if the comment has no validation errors