class User
has_many :subscriptions
has_many :subscribables, :through => subscriptions
end
class Subscription
belongs_to :user
belongs_to :subscribable, :polymorphic => true
end
class XProduct
has_many :subscription_items, :as => :subscribable
end
class YProduct
has_many :subscription_items, :as => :subscribable
end