lib/fish0/concerns/cacheable.rb in fish0-0.0.1 vs lib/fish0/concerns/cacheable.rb in fish0-0.0.2
- old
+ new
@@ -6,16 +6,14 @@
included do
def cache_key(*timestamp_names)
case
when timestamp_names.any?
timestamp = max_updated_column_timestamp(timestamp_names)
- timestamp = timestamp.utc.to_s(:nsec)
- "#{self.class.to_s.tableize}/#{slug}-#{timestamp}"
+ "#{self.class.to_s.tableize}/#{slug || id}-#{timestamp.utc.to_s(:nsec)}"
when timestamp = max_updated_column_timestamp
- timestamp = timestamp.utc.to_s(:nsec)
- "#{self.class.to_s.tableize}/#{slug}-#{timestamp}"
+ "#{self.class.to_s.tableize}/#{slug || id}-#{timestamp.utc.to_s(:nsec)}"
else
- "#{self.class.to_s.tableize}/#{slug}"
+ "#{self.class.to_s.tableize}/#{slug || id}"
end
end
private