github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

rlivsey / acts_as_starred

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Simple plugin to add starring to models — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

import from svn into git 
Richard Livsey (author)
Thu Jan 22 03:21:15 -0800 2009
commit  ea1499ec2ae4d31c64918f5d8191272d54eb3934
tree    1fdc35c1125c59980f29c5ca4cc3080467f3c04e
acts_as_starred /
name age
history
message
file .DS_Store Loading commit data...
file README
file Rakefile
file init.rb
file install.rb
directory lib/
directory tasks/
directory test/
file uninstall.rb
README
ActsAsStarred
=============

Dead simple starring of items - like GMail

Usage
=====

class YourModel < ActiveRecord::Base

  acts_as_starred

end

This gets you:

YourModel#star!
YourModel#unstar!
YourModel#starred_by?(user/user_id)
YourModel#starrings

That's all there is to it.

Assumptions
===========

It assumes that you are using this in conjunction with something like the userstamp plugin
which assigns the current logged in user to created_by fields.

DB Structure
============

Need to add migration generator, but for now just copy this to a migration and 
add any extra required fields

class CreateStarrings < ActiveRecord::Migration
  def self.up
    create_table :starrings do |t|
      t.column :created_by, :integer
      t.column :created_on, :datetime
      t.column :item_id,    :integer
      t.column :item_type,  :string        
    end
  end

  def self.down
    drop_table :starrings
  end
end

Testing
=======

The tests use RSpec, so this needs to be installed in your rails app


Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server