user2320239
user2320239

Reputation: 1038

Adding a remote link to the flash

Hi so I'm working on a project and I want to be able to have a link in the flash that opens in a modal, so I need the link to be remote. So I have

flash[:link] = { text: "Click here",
                 location: new_post_path,
                 remote: true 
               }

but when the flash is loaded, it doesn't actually load as a remote link?

Any help fixing this would be greatly appreciated.

Upvotes: 0

Views: 126

Answers (1)

dp7
dp7

Reputation: 6749

Try this:

flash[:link] = "#{view_context.link_to('Click here',new_post_path, remote: true)}".html_safe

You should render you flash message in view as follows:

<% flash.each do |_, value| %>
    <%= content_tag :div, value %>
<% end %>

Upvotes: 2

Related Questions