Using offline storage

838 views Asked by At

I am trying to make a website which will store all the contacts of the user on the server database. The user can add, edit, delete or update a contact. I want the user to be able to do all these functionality even when he is offline. What should I use to achieve this. I came across web sql database which can be use to store database offline. But I dont know how to synchronise the online and offline database. I am using Ruby on Rails

2

There are 2 answers

0
punnie On

According to Web SQL's W3C page, the specification is no longer in active maintenance and the Web Applications Working Group does not intend to maintain it further (http://www.w3.org/TR/webdatabase/).

Why don't you give HTML5's persistent storage a try instead? There's a great tutorial here that also features a chapter on local storage hacks before HTML5, so you may read it if you're not planning to dive into HTML5 just yet.

You may also try Google Gears, as it features an interface to a local sqlite3 database in which you may store your offline data.

As for the synchronization mechanism try persistanceJS. It should help you with both HTML5 and Google Gears options.

EDIT

Apparently persistanceJS has no support for rails just yet, but there's a tutorial on how to use local HTML5 storage with rails here, and there's a rails plugin to easily enable gears on rails apps here. Those should get you started.

0
hoitomt On

You can use Ruby on Rails to do it as well. Check out the Railscast series of video tutorials. Specifically episode 247 to get started with ROR and offline storage