I have a long list (~50) of items which should each be clickable and
will send an Ajax request to the server. Now, each item will be calling
the same action, just with a different id.
application.js. It's in one place, just call a single function onclick
and pass through the id.
However there are 2 issues:
1. I am worried that the Ajax request from application.js will not have
access to any authenticity token as it was not generated by a Rails
helper, and this could cause problems?
2. I'd prefer to use the Rails helpers to write the remote request if
The easy solution is just to have individual Ajax request code for each
list item's onclick call, but that would bulk out the file a fair bit
and seems messy.
So I'm between a rock and a hard place...
Any advice much appreciated!