I have two models, say Product and Bundle.
products table is related to product_prices table and bundles to bundle_prices (need to make these separations to support multiple currencies)
Obviously both Product and Bundle share some similar methods like get_price
I have make both Product and Bundle pointing to an abstract Class for this, lets say SellableItem.
So now I have:
class Product < SaleableItem
class Bundle < SaleableItem
class SellableItem < ActiveRecord::Base
My question is, how do I add function in SellableItem like this for instance?
def get_price(currency = '')
#get from bundle_prices if object is Bundle or product_prices if object is Product
end
Any help is deeply appreciated