在控制器中,我有以下flash消息:
flash[:notice] = %Q[Please #{view_context.link_to('create a new account',new_account_path)},after that you will be able to create orders.].html_safe
这是布局中的闪存区域:
<div id="main_flash_area"> <% flash.each do |name,msg| %> <div class="alert text-center alert-info"> <a class="close" data-dismiss="alert">× Закрыть</a> <%= msg %> </div> <% end %> </div>
Please <a href="/accounts/new">create a new account</a>,after that you will be able to create orders.
生成的HTML:
<div id="main_flash_area"> <div class="alert text-center alert-info"> <a class="close" data-dismiss="alert">× Закрыть</a> Please <a href="/accounts/new">create a new account</a>,after that you will be able to create orders. </div> </div>