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

15 lines
333 B
Ruby

class SponsorshipAnimal < ActiveRecord::Base
belongs_to :image_file
validates :name, :presence => true
has_many :sponsorship_animal_langs
accepts_nested_attributes_for :sponsorship_animal_langs
def lang(locale)
self.sponsorship_animal_langs.find_by_lang_site_id(LangSite.find_by_slug(locale).id)
end
end