0
我想添加onchange處理程序來查看當前選擇哪個選項並將其放入文件中。 我該怎麼做?選擇表的onchange錯誤
<select id="subtable" name="subtable" size="20" style="width: 400px">
<%= options_from_collection_for_select(@hauses, 'id', 'timebuild', @hauses.first.id), {}, {:onchange => catch()}) %>
</select>
其中控制器是該
def index
@hauses = Hauses.find(:all)
end
def catch
@hs = Hauses.find(params[:hauses_id])
file = File.new("catch.txt","ab")
file.puts(@hs)
file.close
end
它顯示未定義的方法'抓」
謝謝你的任何指導