0
我有我覺得應該是一個簡單的問題,我一直無法解決。我試圖在Rails 4應用程序中呈現json數據時設置cookie。在呈現JSON時創建Cookie
def index
request.cookies[:hi] = 'hello'
render json: User.all
end
我一直在嘗試使用ActionDispatch ::餅乾,一個餅乾變量以及各種其他的方法設定鍵/值,而Googleing,但似乎沒有任何工作,我已經看到了。有什麼建議麼?這是不可能的呈現json?
我已經糾正了我的代碼,以配合你的,並重新啓動我的應用程序,但沒有什麼是出現。 – user2684405
reseponse.set_cookie(key,value)似乎對我有用。 – user2684405
很棒... :) @ user2684405 – Milind