Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/bullet/ext/object.rb
Instance Method Summary collapse
Instance Method Details
#bullet_key ⇒ Object
4 5 6 |
# File 'lib/bullet/ext/object.rb', line 4 def bullet_key "#{self.class}:#{bullet_primary_key_value}" end |
#bullet_primary_key_value ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bullet/ext/object.rb', line 8 def bullet_primary_key_value return if respond_to?(:persisted?) && !persisted? if self.class.respond_to?(:primary_keys) && self.class.primary_keys primary_key = self.class.primary_keys elsif self.class.respond_to?(:primary_key) && self.class.primary_key primary_key = self.class.primary_key else primary_key = :id end bullet_join_potential_composite_primary_key(primary_key) end |