Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

git(hub) mirror of's acts_as_favorite plugin

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

= ActsAsFavorite

This plugin provides a simple way to track users favorites within the system using
ActiveRecord models. 

== Requirements
  As we are not generating anything and there is no config, it is assumed in this version
  that your user class is named "User", and you dont have an existing "Favorite" class.

== Installation and Configuration

1) Install as a plugin using script/plugin.
2) Generate the Favorite model, migrations, and tests with
    ./script/generate favorite_model Favorite
3) rake migrate to create the required tables
4) add <tt>acts_as_favorite_user</tt> to your User model
5) add <tt>acts_as_favorite</tt> to any models which you want to provide to users for favorites.

== The Specifics

  Below are some specifics of using the plugin...

=== Setting and Using favorites

To Set:

To Test(returns true/false):

To Find:
current_user.all_favorites  (all favorite referenced objects, blogs, etc)
current_user.favorite_blogs  (metaprogramming references Blog entries only)
Blog.find(43).favoriting_users (returns users which have the specified blog set as a favorite)

=== Dynamic methods through the Identity mixin

The Identity mixin provides some dynamic methods for accessing favorite based information. You
can replace 'blahs' with any model class that acts_as_favorite.

user.has_favorite_blahs?  --> returns true/false if the user has any favorites within the Blah class.
user.favorite_blahs       --> returns an array of Blah's that are set as the users favorites.

== License
MIT License applies.

== Authors
Josh Martin

Something went wrong with that request. Please try again.