How do I save data on LocalStorage in Ruby on Rails 3.2.8?

后端 未结 4 947
走了就别回头了
走了就别回头了 2021-01-02 10:42

I\'m trying to save a variable called persistent_data.

I usually use session[:persistent_data] or cookies[:persistent_data], b

4条回答
  •  天命终不由人
    2021-01-02 11:32

    Localstorage has nothing to do with rails. You do it the same way as with any other language:

    
    
    localStorage.getItem("company_id");
    => 1
    

    You can use rails to dynamically set the item however:

    
    

提交回复
热议问题