ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Ajax on Rails
Subject:   static class variables in the controller
Date:   2005-10-23 15:43:18
From:   lada77@yahoo.com
Hi,


I'm new to rails n had a question on your example. I got everything to work and for kicks, i added the following code into my controller for testing the ajax observer functions:


@@mycount = 0
def live_search
@@mycount += 1
render_text("count is : " + @@mycount.to_s + "
")
end


I was expecting to see the count increasing by 1 evertime i changed the search text but this is not the case and the variable always remains at 1.


Would you know why this is the case ? Would i have to change some options on my webrick server ?