From eef8b9c3234b01fd8d0668b7e11a5c3feced7eb1 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 15 Aug 2018 20:14:51 -0500 Subject: [PATCH] posts/show: fix flash message when faving/unfaving posts. Bug: if you faved a post, then opened another page in a separate tab, then the "You have favorited this post" flash message would appear in the separate tab. Fixes regression in bcaee199. --- app/controllers/favorites_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/favorites_controller.rb b/app/controllers/favorites_controller.rb index 6456a11d1..5c2dabe6a 100644 --- a/app/controllers/favorites_controller.rb +++ b/app/controllers/favorites_controller.rb @@ -26,7 +26,7 @@ class FavoritesController < ApplicationController def create @post = Post.find(params[:post_id]) @post.add_favorite!(CurrentUser.user) - flash[:notice] = "You have favorited this post" + flash.now[:notice] = "You have favorited this post" respond_with(@post) end @@ -40,7 +40,7 @@ class FavoritesController < ApplicationController Favorite.remove(post_id: params[:id], user: CurrentUser.user) end - flash[:notice] = "You have unfavorited this post" + flash.now[:notice] = "You have unfavorited this post" respond_with(@post) end end