Rails 在 Session 中存放数据

作者:源码世界时间:2014-03-17分类:Ruby/Rails评论:0浏览:5239

1. [代码]hello_controller.rb     跳至 [1]
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

如果您没有找到适合你的解决方案,请联系我们寻求帮助支付鼓励

标签:Ruby/Rails  
返回顶部
分享按钮