Sha256: 0a6e9d0d1906095345389f504694677d7ee8343df207e90403532a876c377203

Contents?: true

Size: 423 Bytes

Versions: 3

Compression:

Stored size: 423 Bytes

Contents

class Object
  def bullet_key
    "#{self.class}:#{self.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| self.send primary_key }.join(','.freeze)
    elsif self.class.respond_to?(:primary_key) && self.class.primary_key
      self.send self.class.primary_key
    else
      self.id
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bullet-5.7.0 lib/bullet/ext/object.rb
bullet-5.6.1 lib/bullet/ext/object.rb
bullet-5.6.0 lib/bullet/ext/object.rb