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]. 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.
