Ok, this is a weird one.
flash[:success] = 'some success message'
redirect_to :controller => 'media', :action => 'index'
The message is being displayed after the redirect, the thing is it also appears one more time after clicking on a link or go to another page in my app (after the first redirect)
For flash, first differentiate between a render and a redirect_to because a flash message is only deleted after a redirect. This you have ok.
Then, if you want a message to be seen in the next request after a redirect, use flash[]. If you want a message to be seen in the current request, use flash.now[].
See if this helps.
If you’re really stuck you can clear it in the view – though you are loading up technical debt with such workaround hacks – but if the clock is ticking right now: