You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using timeoutable, a time out results in two messages being assigned to flash, an alert (expected) and a message of type "timedout" with value true (unexpected).
Expected behavior
That the Flash will only contain notices and alerts.
I realise this has been raised previously (multiple times, see below) and the most prominent one was marked as "resolved" (#1993) but I wonder if, 10-15 years later, we can revisit the decision since it's still tripping people up?
The documentation refers to "notices and alerts" and specifically calls out that the flash is automatically exposed to the template. Tutorials (RubyGuides, Rapid Ruby, Reinteractiveandmanymore) almost always assume the Flash will only contain user facing messages that have been exposed to the template. It seems like a pretty solid convention.
For over a decade, and to this day, people have been:
In case the decision stands and someone else stumbles across this in the future and isn't helped by the terse message in the readme (#1993), I've worked around it by skipping messages of type "timedout" (next if type == "timedout"). Another suggestion is to check if the message/value is a string (next unless message.is_a? String).
Here is that line with a bit more context from my view partial in case it's helpful:
Environment
Current behavior
When using
timeoutable
, a time out results in two messages being assigned to flash, an alert (expected) and a message of type"timedout"
with valuetrue
(unexpected).Expected behavior
That the Flash will only contain notices and alerts.
I realise this has been raised previously (multiple times, see below) and the most prominent one was marked as "resolved" (#1993) but I wonder if, 10-15 years later, we can revisit the decision since it's still tripping people up?
The documentation refers to "notices and alerts" and specifically calls out that the flash is automatically exposed to the template. Tutorials (RubyGuides, Rapid Ruby, Reinteractive and many more) almost always assume the Flash will only contain user facing messages that have been exposed to the template. It seems like a pretty solid convention.
For over a decade, and to this day, people have been:
Workaround
In case the decision stands and someone else stumbles across this in the future and isn't helped by the terse message in the readme (#1993), I've worked around it by skipping messages of type "timedout" (
next if type == "timedout"
). Another suggestion is to check if the message/value is a string (next unless message.is_a? String
).Here is that line with a bit more context from my view partial in case it's helpful:
The text was updated successfully, but these errors were encountered: