I\'m new in rails and I want to use a javascript variable into ruby embedded code to make a query in the database,
This is my code
function modify()
Since Ruby is a Server based language like php or asp/asp.net, using code from the server in the page is very easy like printing it, so if you want to change a javascript variable using server side values is easy. However doing the opposite is a different thing. I would send those values to the server using a proxy call (jQuery most likely). The solution you are asking for calls for the use of a javascript framework like jQuery, not rails that I know.
Try using a jQuery ajax proxy and refreshing data in the client based on server´s response, that will do the trick.
check http://www.jquery.com, use rails to create services that will respond with JSon to your queries.
I hope this help.