jotto wrote: .... > unless session[:countcomment] !=nil > session[:countcomment] = 0.to_i > end I would avoid the double negative: session[:countcomment] = 0.to_i if session[:countcomment].nil? ... > 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 The logic here is saving the comment if the count is greater than 1? The opposite of what you want. Also, why all the to_i calls? Cheers