Module: Bhf::Mongoid::Document
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/bhf/mongoid/document.rb
Defined Under Namespace
Modules: ClassMethods Classes: Field, Reflection
Instance Method Summary collapse
Instance Method Details
#to_bhf_s ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/bhf/mongoid/document.rb', line 39 def to_bhf_s return title if self.respond_to? :title return name if self.respond_to? :name if self.respond_to?(:attributes) return title if attributes['title'] return name if attributes['name'] klass_name = if self.class.respond_to?(:model_name) self.class.model_name.human else self.class.to_s.humanize end return "#{klass_name} ID: #{send(self.class.bhf_primary_key)}" if attributes[self.class.bhf_primary_key] end self.to_s.humanize end |