David Crockett
2008-Nov-25 08:32 UTC
[Facebooker-talk] Sanitizing the New Session Key Format
Facebook''s new session format contains periods and underscores which appear to be breaking mem_cache_store. To get my app working again, I appended the following code to the end of environment.rb class CGI class Session class MemCacheStore def check_id(id) #:nodoc:# id = id.gsub(''-'', '''').gsub(''.'', '''').gsub(''_'', '''') /[^0-9a-zA-Z-]+/ =~ id.to_s ? false : true end end end end The above code tricks rails into thinking the session key only contains alphanumeric characters. How will the non-alphanumeric characters affect rails? Does anyone have a better solution for this problem? - David Crockett