products_variant.rb 429 B

12345678910111213141516
  1. class ProductsVariant < ActiveRecord::Base
  2. belongs_to :product
  3. has_many :available_products
  4. has_many :pointsales, :through => :available_products
  5. enum status: [:erased, :active, :inactive]
  6. acts_as_taggable_on :sizes, :colors, :styles
  7. ##--- Tipo de vistas / consultas
  8. scope :vigentes, -> { where( "status != 0").order(" status ASC") }
  9. def attributes_to_hash
  10. JSON.parse self.attributes_json.gsub('=>', ':')
  11. end
  12. end