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.
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 %>