15 lines
333 B
Ruby
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
|