gravier_app/app/models/product_lang.rb
2017-09-21 12:37:53 +02:00

17 lines
401 B
Ruby
Executable File

class ProductLang < ActiveRecord::Base
belongs_to :product_category
belongs_to :product_collection
#validates :slug, :uniqueness => {:scope => :lang}
before_validation do
self.slug = self.title.to_slug
errors.add(:title, 'doit être présent') if !title? and self.lang == "fr"
errors.add(:title, 'doit être présent') if !slug? and self.lang == "fr"
end
end