1 class Product < ActiveRecord::Base
\r 
   2         set_primary_keys :id  # redundant
\r 
   3         has_many :product_tariffs, :foreign_key => :product_id
\r 
   4         has_one :product_tariff, :foreign_key => :product_id
\r 
   6         has_many :tariffs, :through => :product_tariffs, :foreign_key => [:tariff_id, :tariff_start_date]
\r