Giter VIP home page Giter VIP logo

netconstructor / acts_as_fannable Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heurionconsulting/acts_as_fannable

1.0 1.0 0.0 66 KB

This project is used to help Ruby on Rails Models to associate fans to it..e.g.. People can have fans, Books can have fans, Items can have fans, sports can have fans etc.,. This project helps ruby on rails programmers with a system to implement fannable situation. This project is being exectued by Heurion Consulting. Any comments to this system is always appreciated.

Home Page: http://www.heurionconsulting.com

License: MIT License

acts_as_fannable's Introduction

Acts As Fannable
================================================================

Allows users to become fans to different models.

Installation
----------------------------------------------------------------

Install
 * Run the following command:
 go to vendors/plugins folder and run the following command
 git clone git://github.com/heurionconsulting/acts_as_fannable.git
 
 * Create a new rails migration and add the following self.up and self.down methods
 
  def self.up
    create_table "fans", :force => true do |t|
      t.column "fannable_id", :integer, :default => 0, :null => false
      t.column "fannable_type", :string, :default => "", :null => false
      t.column "user_id", :integer, :default => 0, :null => false
      t.time_stamps
    end
  
    add_index "fans", ["user_id"], :name => "fk_fans_user"
  end

  def self.down
    drop_table :fans
  end

Usage
---------------------------------------------------------------
 
 * Make your ActiveRecord model acts as fan.
 
 class Model < ActiveRecord::Base
 	acts_as_fannable
 end
 
 * Add a fan to a model instance
 
 model = Model.new
 fan = Fan.new
 fan.user_id = user.id (or self.current_user.id if acts_as_authenticated or restful authentication being used)
 model.fans << fan
 or 
 model.add_fan(fan)
 
Credits
---------------------------------------------------------------------

Satish N Kota - Heurion Consutling - This plugin is influenced by Acts As Commentable and I am thankful for them
for writing a wonderful good code.

License
---------------------------------------------------------------------

Refer to MIT License file

acts_as_fannable's People

Stargazers

Christian Hochfilzer avatar

Watchers

Christian Hochfilzer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.