Benjamin J. B.
Benjamin J. B.

Reputation: 1181

Rails Slim syntaxe error with method: :delete

My Slim code in my index view

td= link_to 'Destroy', task, method: :delete, data: confirm: 'Are you sure?'

generates a Slim error

syntax error, unexpected tLABEL ...method: :delete, data: confirm: 'Are you sure?'))).to_s)); ... ^

Do you have a clue and understand the error ?

Upvotes: 2

Views: 1149

Answers (2)

trushkevich
trushkevich

Reputation: 2677

Your problem is just here:

data: confirm: 'Are you sure?'

change it to

data: {confirm: 'Are you sure?'}

Upvotes: 2

Benjamin J. B.
Benjamin J. B.

Reputation: 1181

I think that Slim doesn't like the hash "symbole: value" syntaxe.

Indeed, this code is working :

td= link_to 'Destroy', board, :method => :delete, :data => {:confirm => 'Are you sure?'}  

Upvotes: 1

Related Questions