class SalesDetail < ActiveRecord::Base belongs_to :sale belongs_to :product belongs_to :special_price has_many :pointsales, through: :sale enum status: [:inactive, :active] scope :activos, -> { where.not(sales_details: { status: 0 }) } end