Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# app/helpers/application_helper.rb
def render_messages
order = [:error, :warning, :success, :info]
@messages ||= []
@messages.concat({|k,v| {type: k.to_sym, text: v}}) if flash
@messages.sort_by{|m| order.index(m[:type]) || order.length}
.map{|m| render_message(m[:type], m[:text]) }.join.html_safe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.