Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

polemic

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polemic

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

#Polemic

Build Status

Polemic is comments engine for Rails app. It:

  • provides has_polemic method to any model
  • use User model as commentator
  • provides polemic_for @your_object helper 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.

##Installation

  1. Run rails g polemic:install and rake db:migrate
  2. Add has_polemic to your model, for example Post
  3. Add <%= polemic_for @your_object %> to the show template, for example: <%= polemic_for @post %> to app/views/posts/show.html.erb for Post resource.
  4. ???
  5. PROFIT!

In CanCan is enabled in your project, you will have to add some abilities for creating Comments, for example:

can [:create, :read], Comment

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 app/views/polemic/default. Rename default directory to according model or controller name, for example posts. Don't forget to replace paths in _comments.html.erb view: polemic/default/ => polemic/posts/

Also, you should specify the theme as param for polemic_for helper in the commentable object views:

polemic_for(@post, :theme => "posts")

##Todo

  • Add RSpec tests
  • Add Faye support
  • Do not hardcode User model as a commentator

##Authors

##Feel free for pull requests!

FAQs

Package last updated on 29 Jan 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc