Even if it is actually a one on one relation?
Because we only have a single match in the other table.

Each user has exactly one user_additional, but the user_additional.id (PK) == 
users.id

Arne De Herdt
Software Engineer


ProSiebenSat.1 Games GmbH
A company of ProSiebenSat.1 Media AG

Medienallee 19
D-85774 Unterföhring
Tel. +49 (89) 9507-8808
Fax +49 (89)9507-98934
[email protected]<mailto:[email protected]>
Executive Board: Markus Büchtmann,
Andreas Heyden, Achim Kaspers
Company Residence: Unterföhring
HRB 119657 AG Munich
VAT number DE 182196509
TAX no. 9143/122/60981

From: Jeremy Evans <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, 20 November 2012 20:57
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: Issue with Models mapped to Views

On Tuesday, November 20, 2012 11:51:47 AM UTC-8, Arne De Herdt wrote:
Okay,

This issue is bugging me for weeks now and I do not know how to get around it 
properly.
Basically I have a database with a table called users, which is a view on top 
of another users table in a different database. The view has all columns, a 
primary key assigned and indeces.
I have a table called user_additionals which is again a view from another DB, 
again with primary key assigned and indeces.

When I create the following code:

Class User < Sequel::Model
 one_to_one  :user_additional, key => :id
End

Class UserAdditional < Sequel::Model
  One_to_one :user, key => :id
End

When modeling a one-to-one database relationship in Sequel, the table with the 
foreign key should use a many_to_one relationship, not a one_to_one 
relationship.  This is clearly spelled out in the documentation: 
http://sequel.rubyforge.org/rdoc/files/doc/association_basics_rdoc.html

Jeremy

--
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sequel-talk/-/6ta78unSs4EJ.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
To unsubscribe from this group, send email to 
[email protected]<mailto:[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