Topic: variable in javascript function

I tried to do something like this:

<% some_array.each do |item| %>
  <%= link_to_function "Names", "jsFunction(item)" %>
<% end %>

jsFunction() is in application.js.
when I clicked the link on page, nothing happened.  I checked firebug, it said "item is not defined".  If I put "jsFunction(@controller)", firebug said "refrence to undefined XML @controller".  If I put "jsFunction('VARs')", it worked fine.  It seems rails don't like passing varible to javascript function.  Is there any way to do that or any workaround?

Thanks in advance.

Re: variable in javascript function

Well,

<%= link_to_function "Names", "jsFunction(#{@controller})" %>

Throwing @controller without first specifying you are inserting a ruby variable will result in something totally different as you have seen smile