/active-storage

An ActiveRecord like interface for querying localStorage

Primary LanguageJavaScriptMIT LicenseMIT

Active Storage

Usage

<script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js'></script>
<script src='active-storage.js'></script>
<script>
  var Post = Object.create( new ActiveStorage("Post") );
</script>

Link to the ActiveStorage Library and create a new model.

You now have access to your favorite ActiveRecord methods, powered by localStorage!

.new

var p = Post.new({name: "Jesse"});

.create

var p = Post.create({name: "Jesse"});

#save

p.save();

.find

Post.find( 1 );

.findBy

Post.findBy( {name: "Jesse"} );

.where

Post.where( {name: "Jesse"} );

.all

Post.all();

#destroy

p.destroy();

.destroyAll

Post.destroyAll();