Question

I want to use variables in the confirm message in link_to

<%= link_to 'DESTROY!', @user, :confirm => "are you sure you want to delete #{@user.name}"%>

this doesn't seem to work and it prints "are you sure you want to delete #{@user.name}"

How do I use variables in the confirm message?

Was it helpful?

Solution

It's just a ruby string, confirm has nothing to do with it, are you sure you have double quotes in your actual code? It's not interpolating which is what happens when you have single quotes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top