Merge branch 'reference-cache' into 'master'

Only cache markdown when object has been saved and has a proper cache_key.

See merge request !2119
This commit is contained in:
Robert Speicher 2015-12-16 17:58:14 +00:00
commit e27db8694c

View file

@ -51,7 +51,7 @@ module Mentionable
else else
self.class.mentionable_attrs.each do |attr, options| self.class.mentionable_attrs.each do |attr, options|
text = send(attr) text = send(attr)
options[:cache_key] = [self, attr] if options.delete(:cache) options[:cache_key] = [self, attr] if options.delete(:cache) && self.persisted?
ext.analyze(text, options) ext.analyze(text, options)
end end
end end