Sha256: b223b443da8ca99ca347a555030b19388c35723f76f1105a7fac5555e97714cb

Contents?: true

Size: 416 Bytes

Versions: 15

Compression:

Stored size: 416 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(',')
    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

15 entries across 15 versions & 1 rubygems

Version Path
bullet-5.5.1 lib/bullet/ext/object.rb
bullet-5.5.0 lib/bullet/ext/object.rb
bullet-5.4.3 lib/bullet/ext/object.rb
bullet-5.4.2 lib/bullet/ext/object.rb
bullet-5.4.1 lib/bullet/ext/object.rb
bullet-5.4.0 lib/bullet/ext/object.rb
bullet-5.3.0 lib/bullet/ext/object.rb
bullet-5.2.1 lib/bullet/ext/object.rb
bullet-5.2.0 lib/bullet/ext/object.rb
bullet-5.1.1 lib/bullet/ext/object.rb
bullet-5.1.0 lib/bullet/ext/object.rb
bullet-5.0.0 lib/bullet/ext/object.rb
bullet-4.14.10 lib/bullet/ext/object.rb
bullet-4.14.9 lib/bullet/ext/object.rb
bullet-4.14.8 lib/bullet/ext/object.rb