Flash Messages in Partials (Rails 3)

后端 未结 4 732
孤街浪徒
孤街浪徒 2020-12-28 15:13

I have a partial, _flash.html.haml

- flash.each do |type, value|
  .flash{ :class => type.to_s }
    = value 

Which I\'m re

4条回答
  •  青春惊慌失措
    2020-12-28 15:33

    This will also achieve your desired result:

    <%= render partial: "flash", object: flash %>

    The flash object is being passed to the admin/shared/flash partial as flash, since the partial is called flash. You'll have access to the flash object from within the partial as you'd expect it in any regular view.

提交回复
热议问题