8
我试图追踪“匿名”用户的操作,并最终在注册后将其与他们的帐户相关联。我想通过设置永久性cookie来做到这一点。我最好的选择是在ApplicationController中具有以下内容:在Rails中设置跟踪(永久)cookie的位置?
class ApplicationController < ActionController::Base
before_filter :set_tracking_cookie
def set_tracking_cookie
cookies.permanent[:user_uuid] = SecureRandom.uuid unless cookies[:user_uuid]
end
end
这是正确的方式还是有更好的解决方案?
感谢您的洞察! – janosrusiczki 2013-04-05 06:35:16