I have two models: Sale and payment
class Sale < ActiveRecord::Base has_one :payment end class SaleCancelation < ActiveRecord::Base belongs_to :payment end
I want to create two scopes, "with payment" and "without payment".
"with_payment" works easily:
class Sale < ActiveRecord::Base scope :with_payment, joins( :payment ) end
But how can I create an area that finds every sale that does not have a payment associated with it?
Majiy source share