hanami / controller

Complete, fast and testable actions for Rack and Hanami

Home Page:http://hanamirb.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flash message appears twice (redux)

greggilbert opened this issue · comments

commented

Hey. Following #196, #260, etc., I'm having the double flash issue again in Hanami 1.3.1 (also 1.3.0).

module Web
  class Failure
    include Web::Action

    def call(params)
      # shortened for brevity
      msg = "Something went wrong, try again!"
      flash[:message] = msg
      redirect_to routes.login_path
    end
  end
end
module Web
  class Index
    include Web::Action
    include Hanami::Action::Session

    expose :message

    def call(params)

      message = flash[:message]
      if message
        @message = message
      end
    end
  end
end

As with some of the previous tickets, adding a before { flash.clear } fixes it. Am I not doing something right here?

@GustavoCaso Would you mind to check if this is a flash regression? Thanks.

@greggilbert What's the previous Hanami version you were on?

@jodosha Of course. I will find some time this week to have a look at it.

@greggilbert would be able to provide a copy of your Gemfile?