Local Storage

56 views
Skip to first unread message

Praveen BK

unread,
Nov 24, 2014, 10:43:59 AM11/24/14
to rubyonra...@googlegroups.com
Hello all,

I am trying to build a web application, where most of the data is to
be stored on client side because data changes very often. Only when user
presses submit data, data stored on client side should be pushed to
server.

How to store data on client side? How to retrieve data from server
on submit(no forms).

Data to be stored on client side is ActiveRecord retrieved from
database.

regards,
Praveen

--
Posted via http://www.ruby-forum.com/.

Vivek Sampara

unread,
Nov 24, 2014, 12:53:57 PM11/24/14
to rubyonra...@googlegroups.com
Hey, 

Can you describe "Data" , you mean files or just variables ? If its just files then im not sure but if its variable, you can use javascript global variables or front end frameworks like angular or backbone. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9dd26a3844e66423af4dd085de92b3f4%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Praveen BK

unread,
Nov 25, 2014, 5:48:53 AM11/25/14
to rubyonra...@googlegroups.com
Hello vivek,

I need to store a variables (nested hashmap) on client side and data
in hashmap changes very frequently. When user clicks submit button, data
has to be pushed to server.


regards,
praveen

Vivek Sampara

unread,
Nov 25, 2014, 5:51:35 AM11/25/14
to rubyonra...@googlegroups.com
Then use javascript hash tables 


and when user clicks submit send the hash table as "data" field in ajax 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

Praveen BK

unread,
Nov 25, 2014, 6:20:32 AM11/25/14
to rubyonra...@googlegroups.com
I am trying find the best solution in this case, even json object looks
similar to javascript hash tables you have mentioned. I am refering to
json object as rails renders json object.

json can be passed as data field in ajax.

Colin Law

unread,
Nov 25, 2014, 8:43:04 AM11/25/14
to rubyonra...@googlegroups.com
On 25 November 2014 at 06:18, Praveen BK <li...@ruby-forum.com> wrote:
> I am trying find the best solution in this case, even json object looks
> similar to javascript hash tables you have mentioned. I am refering to
> json object as rails renders json object.
>
> json can be passed as data field in ajax.

Is there a question in the statement above? If so it is not clear
what the question is.

Colin

Praveen BK

unread,
Nov 26, 2014, 6:00:44 AM11/26/14
to rubyonra...@googlegroups.com
Hello,

I have to store nested hashmap on client side, which is the best way
to store nested hashmap on client side. Values inside activerecord
change in client side. When submit button is pressed, hashmap has to be
sent to server through ajax.

Colin Law

unread,
Nov 26, 2014, 7:57:23 AM11/26/14
to rubyonra...@googlegroups.com
On 26 November 2014 at 05:59, Praveen BK <li...@ruby-forum.com> wrote:
> Hello,
>
> I have to store nested hashmap on client side, which is the best way
> to store nested hashmap on client side. Values inside activerecord
> change in client side. When submit button is pressed, hashmap has to be
> sent to server through ajax.

Please quote the message you are responding to when replying so that
we know which message you are replying to. There is no point just
repeatedly making the same statement again and again. Praveen made a
suggestion and you have not responded to it as far as I can see.

The point has been made that you will have to use javascript to do
processing on the client side. Are you familiar with the use of
javascript? If not then you have some learning to do. Find a good
tutorial on javascript and work through it. Then if you need help
with a particular point on how to interface between rails and
javascript come back with specific questions.

Also if you do not know about using the session for storing moderate
amounts of data look up how to use that in rails, it may be useful for
your application.

Colin

Lei Zhang

unread,
Nov 26, 2014, 7:58:59 AM11/26/14
to rubyonra...@googlegroups.com
Depends on what your data is used for.

If your data needs to be shared among sessions, local storage of html5 would be an option.
If not, global variable can meet your requirements. I guess.
Reply all
Reply to author
Forward
0 new messages