Sha256: 3a44602f7f374662062d64dd4dc34e2c6234dfaa53967a12895ac68aadbc6e85

Contents?: true

Size: 439 Bytes

Versions: 7

Compression:

Stored size: 439 Bytes

Contents

module Bhf
  module ActiveRecord

    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']
        return "#{self.class.to_s.humanize} ID: #{send(self.class.primary_key)}" if attributes[self.class.primary_key]
      end

      self.to_s.humanize
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bhf-0.1.6 lib/bhf/active_record.rb
bhf-0.1.5 lib/bhf/active_record.rb
bhf-0.1.4 lib/bhf/active_record.rb
bhf-0.1.3 lib/bhf/active_record.rb
bhf-0.1.2 lib/bhf/active_record.rb
bhf-0.1.1 lib/bhf/active_record.rb
bhf-0.1.0 lib/bhf/active_record.rb