module Bullet::Ext::Object
Public Instance Methods
Source
# File lib/bullet/ext/object.rb, line 28 def bullet_join_potential_composite_primary_key(primary_keys) return read_attribute(primary_keys) unless primary_keys.is_a?(Enumerable) primary_keys.map { |primary_key| read_attribute primary_key } .compact.join(',') end
Source
# File lib/bullet/ext/object.rb, line 9 def bullet_key return "#{self.class}:" if respond_to?(:persisted?) && !persisted? @bullet_key ||= "#{self.class}:#{bullet_primary_key_value}" end
Source
# File lib/bullet/ext/object.rb, line 15 def bullet_primary_key_value return if respond_to?(:persisted?) && !persisted? @bullet_primary_key_value ||= begin primary_key = self.class.try(:primary_keys) || self.class.try(:primary_key) || :id bullet_join_potential_composite_primary_key(primary_key) end end