I would like to do this, but obviously it's wrong. any way to get the ajax return 'cnut' into the erb?
processResults: function (data, params) {
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params.page = params.page || 1;
return {
results: $.map(data, function(cnut) {
<% asdf = BandRole.where(band_id: cnut.id).first %>
<% member = Fan.find(asdf.fan_id) %>
var band_member = <% member.name %>
return {
text: cnut.name + ", " + cnut.city + " (" + band_member + ")",
id: cnut.id,
};
}),
pagination: {
more: (params.page * 30) < data.total_count
}
};
},