I am a beginer in ruby and I want to write a plugin for redmine. I have written a plugin which was running since I use 'flash[:var]' in a controller of my plugin. Now when I want to access to all my pages I have an error message that I not understand.
Ruby version : ruby 1.9.3p484
Rails version : rails 3.2.19
thank you for your answers.
EDIT:
It seems like you ran into situations in which you have nil
values in your flash
. Imagine you have a flash
like { error: nil }
, then you would call v.html_safe
in the content_tag
- what will cause the error.
You might want to extract all values from the flash
that are present?
, before calling content_tag
:
def render_flash_messages
flash.select { |k, v| v.present? }.map do |type, text|
content_tag(:div, text.html_safe, class: "flash #{type}", id: "flash_#{typ}")
end.join
end