Sha256: ff7c14eb6035c327672b05ca8291661e0adfada0203a59375f733130f48c27a5

Contents?: true

Size: 1.83 KB

Versions: 1

Compression:

Stored size: 1.83 KB

Contents

[![Build Status](https://secure.travis-ci.org/ileitch/modis.png?branch=master)](http://travis-ci.org/ileitch/modis)
[![Code Climate](https://codeclimate.com/github/ileitch/modis/badges/gpa.svg)](https://codeclimate.com/github/ileitch/modis)
[![Test Coverage](https://codeclimate.com/github/ileitch/modis/badges/coverage.svg)](https://codeclimate.com/github/ileitch/modis)

# Modis

ActiveModel + Redis with the aim to mimic ActiveRecord where possible.

## Requirements

Modis supports any actively supported Ruby and Ruby on Rails versions. As of 2018-12-20, that means CRuby 2.3+ and jRuby 9k+, as well as Rails 4.2+.

## Installation

Add this line to your application's Gemfile:

    gem 'modis'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install modis

## Usage

```ruby
class MyModel
  include Modis::Model
  attribute :name, :string
  attribute :age, :integer
end

MyModel.create!(name: 'Ian', age: 28)
```

### all index

Modis, by default, creates an `all` index in redis in which it stores all the IDs for records created. As a result, a large amount of memory will be consumed if many ids are stored. The `all` index functionality can be turned off by using `enable_all_index`

```ruby
  class MyModel
    include Modis::Model
    enable_all_index false
  end
```

By disabling the `all` index functionality, the IDs of each record created won't be saved. As a side effect, using `all` finder method will raise a `IndexError` exception as we would not have enough information to fetch all records. See https://github.com/ileitch/modis/pull/7 for more context.

## Supported Features

TODO.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
modis-3.0.0 README.md