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