lib/kredis/attributes.rb in kredis-0.2.0 vs lib/kredis/attributes.rb in kredis-0.2.1

- old
+ new

@@ -76,8 +76,12 @@ when Proc then key.call(self) end end def kredis_key_for_attribute(name) - "#{self.class.name.tableize.gsub("/", ":")}:#{id}:#{name}" + "#{self.class.name.tableize.gsub("/", ":")}:#{extract_kredis_id}:#{name}" + end + + def extract_kredis_id + try(:id) or raise NotImplementedError, "kredis needs a unique id, either implement an id method or pass a custom key." end end