I'm not sure this is the best way to do this, but this ended up working.
JavaScript:
goog.require('goog.net.XhrIo');
var updateQuizStats = function(result) {
var request = new goog.net.XhrIo();
goog.events.listen(request, goog.net.EventType.COMPLETE, function(){
console.log("YES! YES! YES!");
});
request.send('http://localhost:3000/some_method/'+param1+'/'+param2);
}
Rails routes.rb:
match '/some_method/:param1/:param2', :to => 'controller_name#some_method'
In the controller:
def some_method
@my_variable = ModelName.find(params[:param1])
@my_variable.update_attributes(:some_attribute => params[:param2])
end
Would love to hear if there's a better way to do this.