turbolinks - Preventing flash from loading on undesired pages while using Rails and Turbo Links -


i have problem flash message lingering on pages don't want appear on.

i'm using rails 4 turbo links.

while turbo links, think might problem here.

in rails controller i'm setting desire flash follows:

def show      if item.status == "in progress" || item.status == "draft"             flash[:alert] = "please remember: status of text draft. have been granted access through generosity of editor. please use comments make suggestions or corrections."      end  end 

but then, when click link , turbo links responsively loads new page, flash appears again.

any ideas how prevent while continuing use turbolinks

you can either clear flash message in before_action in application controller in application_controller.rb

before_action :clear_flash  def clear_flash   flash.discard end 

or use change code to:

def show  if item.status == "in progress" || item.status == "draft"         flash.now[:alert] = "please remember: status of text draft. have been granted access through generosity of editor. please use comments make suggestions or corrections."  end     end 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

android - MPAndroidChart - How to add Annotations or images to the chart -