app/controllers/lit/localizations_controller.rb in lit-0.4.0.pre.alpha.1 vs app/controllers/lit/localizations_controller.rb in lit-0.4.0.pre.alpha.2
- old
+ new
@@ -13,10 +13,16 @@
format.js
end
end
def update
- after_update_operations if @localization.update_attributes(clear_params)
+ # Wrapping it in a transaction leverages the fact that @localization's
+ # :after_commit callback is then executed AFTER whatever's done in
+ # #after_update_operations. So it'll first set :is_changed to true
+ # and then it will be properly read in the cache setting routine.
+ @localization.transaction do
+ after_update_operations if @localization.update_attributes(clear_params)
+ end
respond_to do |f|
f.js
f.json do
render json: { value: @localization.reload.translation }
end