[Nitro] Og and Relations/Queries

Emmanuel Piperakis epiperak at softlab.ece.ntua.gr
Mon Sep 5 02:33:42 EDT 2005

Hi all,

I have to implement a kind of custom security system, so I have User, 
Group, and Project classes like this:

class User
   property :login,  String
   has_many :groups, Group

class Group
   property   :name,     String
   belongs_to :user,     User
   has_many   :projects, Project

class Project
   belongs_to :group,       Group

   # Returns all the projects that belong to the groups
   # that the currently logged in User belongs to
   def g_all
     @projects = User[session[:user_oid]].groups.projects

Supposing that in session[:user_oid] I have the oid of the currently 
logged in user, would the g_all function work?


Emmanouil Piperakis (epiperak at cs.ntua.gr)
{To explore is Human, to Create is Devine,
  To teach is Primal, to Rule is Sin}

More information about the Nitro-general mailing list