Да, конечно. Рассмотрим это:
# views/layouts/application.html.erb
<% flash.each do |name, msg| -%>
<%= content_tag :div, msg, class: name %>
<% end -%>
# app/controllers/index_controller.rb
def index
flash[:notice] = t("Some notice")
flash[:a_terrible_error] = t("Some terrible error occured")
end
# config/locales/en.yml
en:
"Some notice": "Some Translated Notice"
"Some terrible error occured": "Some translated terrible error occured"
Вы можете добавить любой тип сообщения вы хотите: success
, terrible_error
, foo_bar
на flash
объекта.