Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/interview.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.human_ids ⇒ Object
102 103 104 105 |
# 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 = {}) ⇒ Object
107 108 109 110 |
# File 'lib/interview.rb', line 107 def self.human_name(={}) = {scope: [self.i18n_scope, :models], count: 1}.merge() I18n.translate(self.name.underscore, ) end |
Instance Method Details
#set_human_id ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# 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 |