[eluser]alaminx[/eluser]
[quote author="johlin" date="1287442401"]I've just moved to DMZ from ignitedrecord and I really like how the validation is integrated, but I can't quite figure out how to make my relationships work.
I have on table for users and one for orders. The order table has got a field called userid which cannot be changed (the database is already in use by another application). Also, I can't quite figure out how to choose between a belongs_to and has_one-relationship.
How would I set that relation up so that a user can have many orders and orders belong to one user?[/quote]
You could define user class has-many order
and order has-one user
in order table. you must have field call "user_id" not "userid".
Both 2 table must have primary key is id.