Strain

Gem Version

Description

What does it do?

Strain is an experimental Rails engine that exposes JSON API endpoints for quickly defining and editing structured content. By providing a JSON Schema you get user-editable content types with shared server-side and client-side validation and, through the upcoming Strain-admin editor, autogenerated rich admin interfaces built with React.

Once your content models are stable, you can extend the underlying models with STI to add additional logic. In the future, Strain will be able to generate migrations to promote your content types to full-fledged ActiveRecord models.

Note: This gem is experimental, and will be changing rapidly.

Why do this?

http://alistapart.com/article/future-ready-content

TODO

Requirements

  • Ruby 2.0.0
  • PostgreSQL 9.4 (for jsonb support)
  • Rails 4.2

Installation

Gemfile

Add Strain to your Rails application's Gemfile.

gem 'strain'

After adding the above lines to your Gemfile, run:

$ bundle

Install migrations

After installing the gem, install and run the migrations needed to set up the Strain database tables. This will also enable the Postgres UUID extension.

$ rake strain:install:migrations
$ rake db:migrate

Mount the engine

In routes.rb, specify a path that will serve as the base route for Strain resources.

mount Strain::Engine => "/strain"

Usage

TODO

Feedback

I'd love to discuss any ideas or suggestions you might have. Please file an issue or get in touch with @remedy on Twitter.

License

Copyright 2015 Adam Worrall. MIT License (see LICENSE for details).