32 lines
577 B
Ruby
32 lines
577 B
Ruby
class LabelProduit < ActiveRecord::Base
|
|
belongs_to :label_category
|
|
belongs_to :label_marque
|
|
|
|
has_one :label_famille, :through => :label_category
|
|
|
|
has_many :label_distributeurs, :through => :label_marque
|
|
validates :name, :presence => true
|
|
|
|
|
|
def logo
|
|
|
|
if self.couleur_logo == "orange"
|
|
if self.vegan
|
|
"/label/orange-v.png"
|
|
else
|
|
"/label/orange.png"
|
|
end
|
|
elsif self.couleur_logo == "bleu"
|
|
if self.vegan
|
|
"/label/bleu-v.png"
|
|
else
|
|
"/label/bleu.png"
|
|
end
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|