I have a controller like this in my project:
class BriefcasesController < ApplicationController
...
def update
@super_power = SuperPower.find(params[:super_power_id])
@briefcase.contents.delete(params[:super_power_id].to_s)
flash[:notice] = "Successfully removed #{view_context.link_to(@super_power.title, super_power_path(@super_power)} from your briefcase."
redirect_back(fallback_location: '/briefcase'
end
end
The link_to
helper is not rendering a link to the browser, rather it's printing the html: Successfully removed <a href=\"/powers/1\>flying</a> from your briefcase.
I've also tried using the method #html_safe
on the flash message to no avail. I'm wondering if there's a way to fix this using view_context
or if there's a better way to include a link inside a Flash message.