mbleigh / acts-as-readable
- Source
- Commits
- Network (2)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
commit 37cd25589fd85fc643ffacd32b131e52f549bb60
tree 9a9a9047a5e525b8c4f6281009f2f5ce624fa326
parent 380721c32d4404149a24f90f22640ac17523761a
tree 9a9a9047a5e525b8c4f6281009f2f5ce624fa326
parent 380721c32d4404149a24f90f22640ac17523761a
| name | age | message | |
|---|---|---|---|
| |
README | ||
| |
generators/ | Fri Feb 29 17:12:03 -0800 2008 | |
| |
init.rb | ||
| |
lib/ |
README
ActsAsReadable ============== ActsAsReadable allows you to create a generic relationship of items which can be marked as 'read' by users. This is useful for forums or any other kind of situation where you might need to know whether or not a user has seen a particular model. Installation ============ To install the plugin just install from the SVN: script/plugin install http://svn.intridea.com/svn/public/acts_as_readable You will need the readings table to use this plugin. A generator has been included, simply type script/generate acts_as_readable_migration to get the standard migration created for you. Example ======= class Post < ActiveRecord::Base acts_as_readable end bob = User.find_by_name("bob") bob.readings # => [] Post.find_unread_by(bob) # => [<Post 1>,<Post 2>,<Post 3>...] Post.find_read_by(bob) # => [] Post.find(1).read_by?(bob) # => false Post.find(1).read_by!(bob) # => <Reading 1> Post.find(1).read_by?(bob) # => true Post.find(1).users_who_read # => [<User bob>] Post.find_unread_by(bob) # => [<Post 2>,<Post 3>...] Post.find_read_by(bob) # => [<Post 1>] bob.readings # => [<Reading 1>] Copyright (c) 2008 Michael Bleigh and Intridea, Inc. released under the MIT license

