ActiveRecord

Need to code a model for an order, customer and products to allow

A customer has many orders and orders are comprised of many products.

class Customer < ActiveRecord::Base
has_many :orders
end

class Product < ActiveRecord::Base
belongs_to :orders
end

class Order < ActiveRecord::Base
belongs_to :customers
has_many :products
end
is this code correct?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs