Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.49 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ## Model
  2. class ContainerCharge < ShipmentCharge
  3.   belongs_to :container
  4. end
  5.  
  6. class Container < ActiveRecord::Base
  7.   has_many :container_charges
  8. end
  9.  
  10. class HandlingContainerCharge < ContainerCharge
  11. end
  12. class ShippingContainerCharge < ContainerCharge
  13. end
  14.  
  15. ## Controller
  16.  
  17. #Please assume here that this container has many Handling and Shipping charges
  18. container.container_charges # <- doesn't return the handling and shipping charges,
  19. #only instances of the the super class ContainerCharge