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
What were you trying to do?
I'm using Administrate in an app that authenticates users with Devise+Omniauth. I get this error after the session has expired:
An ActionView::Template::Error occurred in ...#index:
undefined method `html_safe' for true:TrueClass
Did you mean? html_safe?
data: {
"session_id"=>"...",
"user_return_to"=>"/admin",
"flash"=> {
"discard"=>[],
"flashes"=>{
"alert"=>"Your session expired. Please sign in again to continue.",
"timedout"=>true
}
},
in app/views/administrate/application/_flashes.html.erb around line 17 we have
<% flash.each do |key, value| -%>
<div class="flash flash-<%= key %>"><%= value.html_safe %></div>
<% end -%>
since it loops on flash, it ends up calling .html_safe on "timedout"'s value which is true
What did you end up with (logs, or, even better, example apps are great!)?
No permanent solution yet. Visiting the sign_out URL forces new login and resolves the issue temporarily.
What versions are you running?
Rails 6.0.4
administrate 0.16
The text was updated successfully, but these errors were encountered:
In some circumstances, Devise adds a :timedout key to the flash hash, which is not meant for display. Remove this key from the hash if you intend to print the entire hash
We could only iterate over "typical" for Rails flash keys like notice, alert, error, or, before calling .html_safe, verify that the value responds to this method. Without touching administrate code, it can also be done on the application side, a patch for Devise to remove this key and timedout value
Thank you for reporting. A workaround would be to provide a custom template at app/views/administrate/application/_flashes.html.erb for your app. However remember to check that this template hasn't changed in Administrate when you update to a new version.
I'm using Administrate in an app that authenticates users with Devise+Omniauth. I get this error after the session has expired:
in
app/views/administrate/application/_flashes.html.erb
around line 17 we havesince it loops on
flash
, it ends up calling .html_safe on"timedout"
's value which istrue
What did you end up with (logs, or, even better, example apps are great!)?
No permanent solution yet. Visiting the sign_out URL forces new login and resolves the issue temporarily.
What versions are you running?
The text was updated successfully, but these errors were encountered: