mbleigh / relates-to
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
beacba2
commit beacba2a36a769cd2fa477a56de4a28d97cac282
tree e5affce421b8bef16dfe58c84b772bd1ab04f8ed
parent 4aafe65b90e8a9da62b89e63c916f61189132442
tree e5affce421b8bef16dfe58c84b772bd1ab04f8ed
parent 4aafe65b90e8a9da62b89e63c916f61189132442
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
spec/ | ||
| |
tasks/ | ||
| |
uninstall.rb |
README
RelatesTo ========= Relates To provides easy ways to have dual polymorphic bindings between objects with 'natures' included. For instance, if you have users and groups, a user might be related to a group as a leader. This plugin is designed to provide simple-to-use association-like methods to set up relationships and provide all of the necessary helper methods that go with. Example ======= class User < ActiveRecord::Base relates_to :groups, :as => [:leader, :member] end class Group < ActiveRecord::Base has_related :users, :as => [:leader, :member] end @user = User.find(:first) @group = Group.find(:first) @user.relates_to(@group, :as => :leader) @user.groups # => [@group] # TODO @user.groups.as_member # => [] @user.groups.as_leader # => [@group] @group.users # => [@user] # TODO @group.users.members # => [] @group.users.leaders # => [@user] # TODO: generator for relationships table # TODO: default nature Copyright (c) 2008 Michael Bleigh, released under the MIT license

