Skip to content

Commit

Permalink
Merge pull request #33488 from znz/avoid-to-post-twice
Browse files Browse the repository at this point in the history
Throw if ujs loaded twice
  • Loading branch information
rafaelfranca committed Jul 31, 2018
2 parents e2aaf5c + 9df747c commit 1c811cd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion actionview/app/assets/javascripts/rails-ujs/start.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
} = Rails

# For backward compatibility
if jQuery? and jQuery.ajax? and not jQuery.rails
if jQuery? and jQuery.ajax?
throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.') if jQuery.rails
jQuery.rails = Rails
jQuery.ajaxPrefilter (options, originalOptions, xhr) ->
CSRFProtection(xhr) unless options.crossDomain
Expand Down

0 comments on commit 1c811cd

Please sign in to comment.