No commit activity in last 3 years
No release in over 3 years
This gem is heavily influenced by acts_as_voteable & acts_as_rateable, can be used for Thumbs Up/Down or Likes/Dislikes situations, also helps to get the Percentage of Likes to Dislikes and vice versa on an Object, to depict average popularity.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.8.3
>= 0
~> 3.12
 Project Readme

movr_acts_as_likeable¶ ↑

Resources¶ ↑

Install

* Create a new rails migration and add the following self.up and self.down methods

 def self.up
   create_table "likings", :force => true do |t|
     t.column "liking", :boolean, :default => false
     t.column "created_at", :datetime, :null => false
     t.column "likeable_type", :string, :limit => 15, :default => "", :null => false
     t.column "likeable_id", :integer, :default => 0, :null => false
     t.column "user_id", :integer, :default => 0, :null => false
   end

   add_index "likings", ["user_id"], :name => "fk_likings_user"
 end

 def self.down
   drop_table :likings
 end

Usage¶ ↑

* Make your ActiveRecord model act as likeable.

class Model < ActiveRecord::Base
   acts_as_likeable
end

* Add a liking to a model instance

model = Model.new
liking = Liking.new(:liking => 1) (0=dislike, 1=like)
model.likings << liking / model.add_liking(liking)

* Each liking references the likeable object

model = Model.find(1)
model.likings.get(0).likeable == model

* Count total likes of the likeable object

model.find(1)
model.likes_count (Count of Likes)

* Count total dislikes of the likeable object

model.find(1)
model.dislikes_count (Count of DisLikes)
  • Count percentage of likes to dislikes for the likeable object

model.find(1)
model.likes_percentage
  • Count percentage of dislikes to likes for the likeable object

model.find(1)
model.dislikes_percentage

Inspiration¶ ↑

This Plugin is heavily influenced by acts_as_voteable & acts_as_rateable, can be used for Thumbs Up/Down or Likes/Dislikes situations, also helps to get the Percentage of Likes to Dislikes and vice versa on an Object, to depict average popularity.

Contributing to movr_acts_as_likeable¶ ↑

  • 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 © 2012 github.com/umerfarooq (umerfarooq) on github for origonal plugin and Daryl Moulder github.com/darmou. See LICENSE.txt for further details.