I check that out tomorrow. Thanks!

Christian

2011/3/21 funny_falcon <[email protected]>:
> And one could use :class option to set up class of association
>
> So it should look lik
>
> class Friendship < Sequel::Model
>  many_to_one :user
>  many_to_one :friend, :class => :User, :key => :friend_id
> end
>
> class User < Sequel::Model
>  one_to_many :friendships
>  many_to_many :friends, :join_table => :friendships, :right_key
> => :friend_id, :class => :User
> end
>
> (not checked)
>
> On 21 мар, 20:22, funny_falcon <[email protected]> wrote:
>> Sequel::Model has no :through option. (http://sequel.rubyforge.org/
>> rdoc/files/doc/advanced_associations_rdoc.html)
>>
>> On 21 мар, 19:12, Christian MICHON <[email protected]> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Hi,
>>
>> > I've been trying to make with Sequel something similar 
>> > tohttp://asciicasts.com/episodes/163-self-referential-association(it's
>> > based on my ramaze/sequel clone of flitter).
>>
>> > I've been trying to code it like this:
>>
>> > class Friendship < Sequel::Model
>> >   many_to_one :user
>> >   many_to_one :friend, :class => :User, :key => :friend_id
>> > end
>>
>> > class User < Sequel::Model
>> >   one_to_many :friendships
>> >   one_to_many :friends, :through => :friendships
>> > end
>>
>> > When I try to select a created User, and I perform this
>> > User[1].friends, I end up with:
>> > "NameError: uninitialized constant Friend"
>>
>> > Basically, it was expecting the alias to work (friends are actually
>> > users), so I was not expecting to have to declare the class Friend. Is
>> > there a way to properly code this in Sequel ?
>>
>> > Thanks in advance.
>> > Christian
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sequel-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/sequel-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-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/sequel-talk?hl=en.

Reply via email to