2009/9/4 Ar Chron <[email protected]>: > > Well the quirky part is that yes, the user has a role, but only in the > context of a sandbox. > > The admin for this one, a user in that one, hopefully a donkey in > none... > > The show does work, but I admit I don't particularly like the syntax. > admins, users or donkeys are participations, not users directly. >
If there are (and will always be) only the two categories of participation, ie sandbox owner and regular participant then this might be better Sandbox belongs_to :owner, :class_name => 'User', :foreign_key => owner_id has_and_belongs_to_many :users User has_many :owned_sandboxes, :class_name => 'Sandbox', :foreign_key => owner_id has_and_belongs_to_many :sandboxes Or along those lines anyway, I may not have got the syntax quite right This allows one to say sandbox.owner the user that is the owner sandbox.users all the other users user.owned_sandboxes the ones (if any) that he owns user.sandboxes all the rest that he participates in Colin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

