Is it possible to add link to the flash message when it's confirmed?

devise, ruby-on-rails, ruby-on-rails-3

Solution

I had trouble implementing these solutions. All I needed was a simple HTML link in the flash. Here's how I implemented it in Rails 4.1. I just had to sanitize my flash messages in app/views/shared/_flash.html.erb:

<% flash.each do |name, msg| %>
  <div class="alert alert-<%= name %>">
    <a class="close" data-dismiss="alert">&#215</a>
    <% if msg.is_a?(String) %>
      <div id="flash_<%= name %>"> <%= sanitize(msg) %> </div>
    <% end %>
  </div>
<% end %>

And in my controller, I just entered HTML directly and without .html_safe. Works a treat!

flash[:notice] = %Q[Please <a href="#">click here</a>]

Problem

I'm using Devise. When the user succeeded at confirmation, the flash message appears. I'd like to add a link to it. So I want this message instead `Your account was successfully confirmed. You are now signed in. Go to your profile page, and edit it!` Then the part of `profile` should be the link to `example.com/users/username/edit` How can I make it possible? devise.en.yml ``` confirmations: confirmed: 'Your account was successfully confirmed. You are now signed in.' ```

Original source

Related problems