class InvoiceDetail < ActiveRecord::Base # has_and_belongs_to_many :credits, join_table: :invoice_credits audited enum status: [:cancelled, :active] scope :activas, -> { where(invoice_details: { status: 1 }) } scope :complementos, -> { activas.where(cfdi_type: "P") } end