Rails 在 Session 中存放数据 2014/10/20 16424 class HelloController < ApplicationController def there @counter1 = 1 if(session[:counter2]) @counter2 = session[:counter2] @counter2 += 1 session[:counter2] = @counter2 else @counter2 = 1 session[:counter2] = @counter2 end end end