Commit c7df9771 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'backport-md-cache-fix' into 'master'

Work around a hard-to-understand failure in `CacheMarkdownField`

See merge request !10918
parents 465a8180 0e24b128
......@@ -120,7 +120,9 @@ module CacheMarkdownField
attrs
end
before_save :refresh_markdown_cache!, if: :invalidated_markdown_cache?
# Using before_update here conflicts with elasticsearch-model somehow
before_create :refresh_markdown_cache!, if: :invalidated_markdown_cache?
before_update :refresh_markdown_cache!, if: :invalidated_markdown_cache?
end
class_methods do
......
......@@ -18,7 +18,7 @@ describe CacheMarkdownField do
end
extend ActiveModel::Callbacks
define_model_callbacks :save
define_model_callbacks :create, :update
include CacheMarkdownField
cache_markdown_field :foo
......@@ -56,7 +56,7 @@ describe CacheMarkdownField do
end
def save
run_callbacks :save do
run_callbacks :update do
changes_applied
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment