Polemic is comments engine for Rails app. It:
- provides has_polemic method to any model
- use User model as commentator
polemic_for @your_objecthelper to display the object comments in views.
Requirements and recommendations
Polemic requires Rails 3.x and Devise for user identification (surely, comments are not possible without users). This version of the gem is tested only with MRI 1.8.7, MRI 1.9.3, and REE.
Remember that unfortunately, Polemic reserves
Comment for resource name.
rails g polemic:installand
has_polemicto your model, for example Post
<%= polemic_for @your_object %>to the
showtemplate, for example:
<%= polemic_for @post %>to
app/views/posts/show.html.erbfor Post resource.
In CanCan is enabled in your project, you will have to add some abilities for creating Comments, for example:
can [:create, :read],
If you have no CanCan, Polemic will not use
authorize_resource in CommentsController.
You can use hint from Devise Wiki to directly convert Polemic ERB views to HAML.
Themes and views
Polemic supports theming and usage of custom views. Firstly, you should copy default views with generator:
rails generate polemic:views
Then, you will have polemic views in
default directory to according model or controller name, for example
posts. Don't forget to replace paths in
Also, you should specify the theme as param for
polemic_for helper in the commentable object views:
polemic_for(@post, :theme => "posts")
- Add RSpec tests
- Add Faye support
- Do not hardcode
Usermodel as a commentator
- Kir Shatrov (Evrone Company)