class Customer
scope :active_whole_year, -> { joins(:subscription => :subscription_type).merge(Subscription.active_whole_year) }
end
class Subscription
scope :active_whole_year, -> { joins(:subscription_type).merge(SubscriptionType.whole_year) }
end
class SubscriptionType
scope :whole_year, -> { where(:name => WHOLE_YEAR) }
end
class Customer
scope :active_whole_year, ->