Sha256: 0bd6cb1cc4bcf971607a55857f1c073945621e369b8304791f647ad14ef01b07

Contents?: true

Size: 403 Bytes

Versions: 4

Compression:

Stored size: 403 Bytes

Contents

class Object
  def bullet_key
    "#{self.class}:#{primary_key_value}"
  end

  def primary_key_value
    if self.class.respond_to?(:primary_keys) && self.class.primary_keys
      self.class.primary_keys.map { |primary_key| send primary_key }.join(','.freeze)
    elsif self.class.respond_to?(:primary_key) && self.class.primary_key
      send self.class.primary_key
    else
      id
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bullet-5.7.4 lib/bullet/ext/object.rb
bullet-5.7.3 lib/bullet/ext/object.rb
bullet-5.7.2 lib/bullet/ext/object.rb
bullet-5.7.1 lib/bullet/ext/object.rb