I want to count, perhaps with session variables, to ensure that the
user is not abusing AJAX features.
so on the particular page that has the ajax
unless session[:countcomment] !=nil
session[:countcomment] = 0.to_i
end
then, i check to see if the session[:countcomment] is greater than 1,
if it is, then no other ajax submissions are allowed, I tried to do
this with the following code:
if session[:countcomment].to_i > 1.to_i
if thiscomment.save
session[:countcomment] = session[:countcomment].to_i + 1.to_i
render some text
end
else
render_text “too many posts”
end
Except, this isn’t working. Can variables be declared in Ruby? Is this
a poor approach to trying to limit AJAX activity?