Displaying 1 result from an estimated 1 matches for "allocated_product_id".
2011 Feb 09
4
Modules being shared and model data
...d::Base
include Pricing
attr_accessible :name, :code, :cost, :company_id, :margn
belongs_to :company
has_many :allocations
has_many :companies, :through => :allocations
end
An allocation model:
class Allocation < ActiveRecord::Base
include Pricing
attr_accessible :company_id, :allocated_product_id, :quantity,
:saledate, :cost
belongs_to :company
belongs_to :allocated_product, :class_name => ''Product'' #So you have
company.products and company.allocated_products.
end
A products and allocations controller:
class ProductsController < ApplicationController
def index...