Wondering if it possible to programmatically setup a relation between two activerecord classes? I don't have a foreignkey setup via the database (dba won't let it happne for whatever reason) so now, via code, I'd like to have, for example, a Orders class that has a collection of type Order class which then has a related Product class that can be linked via a collection in the Order class. So, Orders would have a OrderCollection of type Order and Order would have a ProductsCollection of type Product and can then be loaded based on primary/foreign key columns (that I specify)? I tried googling for it and found some broken links to a manymany class or something of the sort...
So Orders contains Order which contains Product
Orders->Order->Products
using pseudo code i could do something like:
Order order = new Order();
order.UserID = 1;
Product product = new Product().LoadByKey(240386);
order.Products.Add(product);
Orders orders = new Orders();
orders.OrderCollection.Add( order );
orders.save();
Possible?