Fix to_json for storing user preferences
This commit is contained in:
parent
4aededf038
commit
c85903383a
1 changed files with 3 additions and 3 deletions
|
@ -956,7 +956,7 @@ post "/login" do |env|
|
|||
|
||||
if env.request.cookies["PREFS"]?
|
||||
preferences = env.get("preferences").as(Preferences)
|
||||
PG_DB.exec("UPDATE users SET preferences = $1 WHERE email = $2", preferences, user.email)
|
||||
PG_DB.exec("UPDATE users SET preferences = $1 WHERE email = $2", preferences.to_json, user.email)
|
||||
|
||||
cookie = env.request.cookies["PREFS"]
|
||||
cookie.expires = Time.new(1990, 1, 1)
|
||||
|
@ -1129,8 +1129,8 @@ post "/login" do |env|
|
|||
end
|
||||
|
||||
if env.request.cookies["PREFS"]?
|
||||
preferences = env.get("preferences").as(Preferences).to_json
|
||||
PG_DB.exec("UPDATE users SET preferences = $1 WHERE email = $2", preferences, user.email)
|
||||
preferences = env.get("preferences").as(Preferences)
|
||||
PG_DB.exec("UPDATE users SET preferences = $1 WHERE email = $2", preferences.to_json, user.email)
|
||||
|
||||
cookie = env.request.cookies["PREFS"]
|
||||
cookie.expires = Time.new(1990, 1, 1)
|
||||
|
|
Loading…
Reference in a new issue