class ActiveRecord::Base
Public Class Methods
human_ids()
click to toggle source
# File lib/interview.rb, line 102 def self.human_ids objects = select("\"#{self.table_name}\".\"human_id\"").order(:human_id) return objects.map { |object| object.human_id } end
human_name(options={})
click to toggle source
# File lib/interview.rb, line 107 def self.human_name(options={}) options = {scope: [self.i18n_scope, :models], count: 1}.merge(options) I18n.translate(self.name.underscore, options) end
Public Instance Methods
set_human_id()
click to toggle source
# File lib/interview.rb, line 88 def set_human_id if respond_to? :human_id if respond_to? :name self.human_id = self.name.to_s elsif respond_to? :title self.human_id = self.title.to_s elsif respond_to? :description self.human_id = self.description.to_s else self.human_id = self.id.to_s end end end