?

Log in

No account? Create an account
entries friends calendar profile adric.net Previous Previous Next Next
Zencart as seen by Rails? - nil.enroll(aetheric_username, quantum_class_id)
yljatlhQo'! QIch lo'laltbebej!
adric
adric
Zencart as seen by Rails?
The fruit of today's labour:
zc_order Order:
  has_one :customer, :foreign_key => "customers_id"
  has_many :orderproducts, :class_name => 'OrderProduct', :foreign_key => 'orders_id'
  has_many :products, :through => :orderproducts

zc_customers Customer:
  has_many :orders, :class_name => 'Order', :foreign_key => 'order_id'

zc_customers Product:
  has_many :orders, :class_name => 'Order', :foreign_key => 'orders_id'
  has_one :productdescription, :class_name => "ProductDescription",
    :foreign_key => 'products_id'
  has_many :orders

zc_products_description ProductDescription
  has_one :productdescription, :class_name => "ProductDescription",
    :foreign_key => 'products_id'

zc_orders_products OrderProduct:
  belongs_to :order, :foreign_key => "orders_id"
  belongs_to :product, :foreign_key => "products_id" 
this works:
>> @summary = Order.all.collect do |@o| 'Order: ' + @o.orders_id.to_s + ' was: ' + @o.products.collect do |@prod| @prod.products_id.to_s + ' ' + @prod.productdescription.products_name end.to_s + ' for: ' + @o.customers_name end

Tags:
Current Mood: drained drained
Current Music: Massive Attack - Teardrop | Powered by Last.fm

Leave a comment