Nick Ginanto
Nick Ginanto

Reputation: 32130

Using variables in link_to :confirm

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?

Upvotes: 2

Views: 755

Answers (1)

Cluster
Cluster

Reputation: 5617

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.

Upvotes: 2

Related Questions