I have ajax links on my view, on which I want to check password before they're sent to the actual action, as I am using devise controller, i am restricted to the use of specific password check. Following is the coffee script I wish to use for the validation.
.<%= link_to "CANCEL PAYMENT", { :action => "some_action", :info => n.id },class: "css_class",:remote => true %>
I am using the above link
I am looking for a following kind of code.
$("a.css_class").live "click", -> password_variable = prompt("Enter password", "password") if |ruby-code|current_user.valid_password?(password_variable)|ruby-code| true else alert "You entered wrong password" false
How'll the ruby code work with coffee script mix.