Skip to content

Commit 90a9072

Browse files
authored
On the relentless case to try endless methods (#37)
1 parent e5b5975 commit 90a9072

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/active_record/associated_object.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,13 @@ def cache_key_with_version
4141
end
4242
delegate :cache_version, to: :record
4343

44-
def cache_key
45-
case
46-
when !record.cache_versioning?
47-
raise "ActiveRecord::AssociatedObject#cache_key only supports #{record.class}.cache_versioning = true"
48-
when new_record?
49-
"#{model_name.cache_key}/new"
50-
else
51-
"#{model_name.cache_key}/#{id}"
52-
end
44+
def cache_key = case
45+
when !record.cache_versioning?
46+
raise "ActiveRecord::AssociatedObject#cache_key only supports #{record.class}.cache_versioning = true"
47+
when new_record?
48+
"#{model_name.cache_key}/new"
49+
else
50+
"#{model_name.cache_key}/#{id}"
5351
end
5452
end
5553
include Caching

0 commit comments

Comments
 (0)