Blakstar Like

Simple plugin for handling positive and negative likes. This stuff has been made for Blakstar cms and used in production, but released as a free solution.

Examples

First, generate the migration file.


rails generate migration blakstar_like_migration

Generator is missing right now!

Include blakstar_like in a model you want to like.

Class Post < ActiveRecord::Base</p>
blakstar_like

<p>end

The following methods will be available:


@post.like!( @user_1 )

@post.dislike!( @user_2 )

@post.average_like #=> 0

@post.count_likes! #=> 1

@post.count_dislikes! #=> 1

Caching

If you add two new fields to Post – :likes_count and :dislikes_count – the plugin automatically caches the total number of likes / dislikes to speed up calculations.

.h2 Contributing to blakstar_like

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.
  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2010-2012 Ferenc Fekete (Mr. Black), GergÅ‘ Sulymosi rblack.hu), GergÅ‘ Sulymosi