[Nitro] Og and Relations/Queries

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


Dear friends,
after a lot of investigating I found the problem:
When defining relations you have some choices that do not apply to all
types of relations. So here are the available choices:
(first is the most prefarable by G., last is the least)

belongs_to :article
belongs_to Article
belongs_to :article, Article
belongs_to :article, Article, :view => 'lala'

refers_to :topic
refers_to Topic

has_one User # THIS RELATION has only one way to be declared!!! BE AWARE!

has_many :comments ### GEORGE, please verify if this is CORRECT!
has_many Comment
has_many :comments, Comment

The problem I was facing was when using the has_one (incorrect syntax), 
that did not put out an error, but also did not create the table.

...epiperak out...


> On 9/5/05, Emmanuel Piperakis <epiperak at softlab.ece.ntua.gr> wrote:
>>> in general the following forms work:
>>>
>>> has_many :projects, Project
>>> has_many Project
>>> has_many :projects
>>>
>>> all three are equivalent. I personally prefer the 3rd.
>>
>> Thank you for your reply, but my question is How can I make the queries.
>> So if I want all the projects that belong to any of the groups of the
>> current user would the following line work?
>>
>> @projects = User[session[:user_oid]].groups.projects
>>
>> and would it return an array of projects as I would expect?
>>
>> Thanx again...
>>
>> PS. When is the new server coming up online? :-/
>>
>>
>
> I said 'yes', this would work :-)
>
> -g.
>
> -- 
> http://www.gmosx.com
> http://www.navel.gr
> http://www.nitrohq.com
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>

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