I'm coding a scrabble application and I want to call an update method when the player drops a tile so I change the position in the database
function update_position(ev, posx, posy)
{
new Ajax.Request('/tiles_controller/update', {
method: 'post',
parameters: {
posx: posx
posy: posy}
});}`
and my controller looks like
def update
@tile = Tile.find(params[:id])
@tile.update_attributes(params[:tile])
end
end
end
I know the controller doesn't work I'm newbie coding in rails and I'm not sure how to pass the parameters from the javascript.
Please help