Code Climate Gem Version Build Status Dependency Status

Databound

Exposes ActiveRecord records to the Javascript side.

This is the Ruby on Rails backend part for the Databound javascript lib.

For more information go to javascript Databound repo.

Javascript library

It does something like this out of the box.

  User = new Databound('/users');

  User.update({ id: 15, name: 'Saint John' }).then(function(updated_user) {
  });

Installation

The library has two parts and has Lodash as a dependency.

I. Javascript part

Follow the guide on javascript Databound repo.

II. Ruby on Rails part

1. Add gem 'databound' to Gemfile.

2. Create a controller with method model which returns the model to be accessed. Also include Databound

class UsersController < ApplicationController
  include Databound

  private

  def model
    User
  end
end

3. Add a route to routes.rb

# This creates POST routes on /users to UsersController
# For where, create, update, destroy

databound :users

Additional features

All features are described in javascript Databound repo.