[Nitro] RES: many to many - advanced relationships
Antoniolo
antoniolo at gmail.com
Sun Mar 11 08:39:39 EDT 2007
Just one more question:
class Personage
property :nickname, String
many_to_many :skills, :through => PersonageSkill
end
class Skill
property :title, String
many_to_many :skills, :through => PersonageSkill
end
class PersonageSkill
property :value, Float
has_one :personage
has_one :skill
end
ok, that solves my previous problem, however I've got another one and here
as it follows:
me = Personage.new
me.nickname = 'antonio'
archery = Skill.new
archery.title = 'archery'
me.skills.add archery, :value => 45.5
me.save
Everything runs beautifully, except, the field 'value' doesn't save
anything. But, if I insert some saves before 'me.skills.add' like 'me.save'
and 'archery.save' it updates correctly.
My application needs to deal with not saving objects until world save timer
to trigger them. In fact, I've seen that Og does cascade saves ... but not
only with advanced many-to-many.
Do you have any solutions for that?
Antonio.
-----Mensagem original-----
De: nitro-general-bounces at rubyforge.org
[mailto:nitro-general-bounces at rubyforge.org] Em nome de George Moschovitis
Enviada em: Sunday, March 11, 2007 4:33 AM
Para: General discussion about Nitro
Assunto: Re: [Nitro] many to many - advanced relationships
Welcome to this list,
Yeah, this more or less works like AR, ie:
class Article
joins_many :first_join, Category, :through => ArticleToCategory
end
for more examples check out, og/test/og/tc_join.rb
regards,
George.
On 3/11/07, Antoniolo <antoniolo at gmail.com> wrote:
> Hi Nitro-People :)
>
>
> I've been developing a game server app and I'd really like to upgrade my
> models from active-record to Og. I'm fascinated with Nitro and specially
Og
> :). However, before doing that, I only need to know how to manage advanced
> many-to-many relationships, I mean, a table not only with foreign ids, but
> also with some fields.
>
> In active-record, we use has_many/through(since many_to_many cannot handle
> that). Is there a similar alternative in Og?
>
>
> Sorry for asking a newbie question, but I tried to find an entry about
that
> ...
>
>
>
> Cheers, Antonio
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
--
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org
_______________________________________________
Nitro-general mailing list
Nitro-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/nitro-general
More information about the Nitro-general
mailing list