Skip to content

Commit

Permalink
Fix flash message. (#125)
Browse files Browse the repository at this point in the history
Before:
> flash.inspect
=> #<ActionDispatch::Flash::FlashHash:0x0000000116592308 @discard=#<Set: {"allow_other_host", "flash"}>, @Flashes={"allow_other_host"=>false, "flash"=>{"error"=>"Sorry, that was too quick! Please resubmit."}}, @now=nil> 

`flash[:error]` is empty and the error message only accessible as `flash.to_h.dig("flash", "error")`.


Whereas when I manually set `flash[:error]` in Rails, the flash looks like this:

#<ActionDispatch::Flash::FlashHash:0x0000000113511418 @discard=#<Set: {"error"}>, @Flashes={"error"=>"AAAA"}, @now=nil>
  • Loading branch information
jankoegel authored Jul 25, 2023
1 parent 0388e1f commit 1b70b6e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/invisible_captcha/controller_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def on_timestamp_spam(options = {})
if action = options[:on_timestamp_spam]
send(action)
else
redirect_back(fallback_location: root_path, flash: { error: InvisibleCaptcha.timestamp_error_message })
flash[:error] = InvisibleCaptcha.timestamp_error_message
redirect_back(fallback_location: root_path)
end
end

Expand Down

0 comments on commit 1b70b6e

Please sign in to comment.