Class: Object

Inherits:
BasicObject
Defined in:
lib/bullet/ext/object.rb

Instance Method Summary collapse

Instance Method Details

#bullet_keyObject



2
3
4
# File 'lib/bullet/ext/object.rb', line 2

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

#primary_key_valueObject



6
7
8
9
10
11
12
# File 'lib/bullet/ext/object.rb', line 6

def primary_key_value
  if self.class.respond_to?(:primary_key) && self.class.primary_key
    self.send self.class.primary_key
  else
    self.id
  end
end