1
0
Fork 0
forked from OpenNeo/impress
impress/app/models/species.rb

17 lines
372 B
Ruby

class Species < ActiveRecord::Base
translates :name
scope :alphabetical, lambda { with_translations(I18n.locale).order(Species::Translation.arel_table[:name]) }
def as_json(options={})
{:id => id, :name => human_name}
end
def human_name
if name
name.capitalize
else
I18n.translate('species.default_human_name')
end
end
end