Closed ringofhealth closed 10 years ago
It could be you are not including the Rails jQuery unobstrusive module
application.js
//= require jquery
//= require jquery_ujs
Those files were included, but $.rails came up as undefined when I check it in console. So I downloaded a seperate copy of ujs, and loaded it into my global directory, and it worked. Thanks!
The issue now is that both button apparently confirm(thus delete the account), i cant cancel out
Here is my the link
<%= link_to '<button class="btn btn-sm btn-danger pull-left " >Delete My Account </button>'.html_safe, user_path, method: "delete", data: {
confirm: 'Are you sure you want to delete?',
:'confirm-button-text' => 'No',
:'cancel-button-text' => 'Yes',
type: 'warning',
text: 'This Action Can Not Be Undone',
} %>
Seems you have swapped buttons
They should be:
:'confirm-button-text' => 'Yes',
:'cancel-button-text' => 'No',
I tried both button, they both goto my destroy action in my controller
here is the action
def destroy
@property = Property.find(params[:id])
if @property.destroy
render 'index'
end
end
Are you using it from git ? bundle update sweet-alert-confirm
fix the
problem?
El 23/10/2014 16:52, "replicat0r" notifications@github.com escribió:
I tried both button, they both goto my destroy action in my controller
here is the action
def destroy @property https://github.com/property = Property.find(params[:id]) if @property.destroy render 'index' end
end
— Reply to this email directly or view it on GitHub https://github.com/mois3x/sweet-alert-rails-confirm/issues/3#issuecomment-60311534 .
I just did an update, it didn't do anything, both options still delete the data
Same issue as above. When implemented in rails 4 the method doesn't return false when you click the cancel button with a basic confirm dialog and submits to the action regardless of which button you press.
gem pushed, bundle update should fix the problem now
Its fixed for me! Thanks a lot for the prompt reply and update!
Running into JavaScript error after the dialogue pops up, When I try to click any of the two options
Uncaught TypeError: Cannot read property 'handleMethod' of undefined
I am using Rails 4.0.0
The script is runing into an error at line 44 $.rails.handleMethod($linkToVerify)
Linkto Verify is defined as
$linkToVerify = $(this)
I think this is not referenced...