Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What approach do you take for embedding links in flash messages?

Tags:

The ability to have flash messages (notice, error, warning, etc) with embedded links is nice from a user interaction standpoint. However, embedding an anchor tag inside a flash message from the controller is dirty.

Let's assume that a flash message like this is good for usability*:

Example Flash Message Notice with an Embedded Link http://img.skitch.com/20090826-xbsa4tb3sjq4fig9nmatakthx3.png (borrowed from DailyMile.com)

What tactic would you take between the controller and view to employ something like this cleanly?

like image 942
Ryan McGeary Avatar asked Aug 26 '09 02:08

Ryan McGeary


1 Answers

Just thought I would share this, since found answer I was looking for elsewhere:

Works on rails 3.1

flash[:notice] = "Proceed to #{view_context.link_to('login page', login_path)}".html_safe 
like image 66
jjnevis Avatar answered Oct 14 '22 12:10

jjnevis