Skip to content

Commit

Permalink
Merge pull request #255 from homakov/patch-1
Browse files Browse the repository at this point in the history
small fix for CSRF tokens
  • Loading branch information
Neeraj Singh committed Apr 25, 2012
2 parents caabad7 + f51fb62 commit bb13c9d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rails.js
Expand Up @@ -374,4 +374,11 @@
if (this == event.target) rails.enableFormElements($(this));
});

$(function(){
// making sure that all forms have actual up-to-date token(cached forms contain old one)
csrf_token = $('meta[name=csrf-token]').attr('content');
csrf_param = $('meta[name=csrf-param]').attr('content');
$('form input[name='+csrf_param+']').val(csrf_token);
});

})( jQuery );

0 comments on commit bb13c9d

Please sign in to comment.