Provides ActiveRecord compatibility for Sequel
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib/sequel/plugins
spec
.gitignore
CHANGELOG.md
Gemfile
README.md
Rakefile
circle.yml
sequel-active_record.gemspec

README.md

ActiveRecord plugin for Sequel

CircleCI Gem Version Semantically Versioned

Provides a set of features that make Sequel more compatible with code that was written for ActiveRecord. Long-term goal is to make a near drop-in replacement to ease the transition for projects that were previously built with ActiveRecord as the default ORM. Individual features may be enabled / disabled when including this plugin.

Please see the examples section and the features table below.

Installation

Add this line to your application's Gemfile:

gem 'sequel-active_record'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sequel-active_record

Examples

As with any Sequel plugin, this may be invoked on Sequel::Model or any of its subclasses. By default, all features are loaded. This may be changed by specifying an array of specific features during invocation.

# Loads all features for all models
Sequel::Model.plugin :active_record

# Load selected features on a specific model
class Artist < Sequel::Model; end;
Artist.plugin :active_record, features: [:first, :last]

# May be called multiple times to load additional features
Artist.plugin :active_record, features: [:finder_methods]

Features

Feature Description ActiveRecord Sequel
:first Overrides #first to implicitly sort by the primary key #first #first
:finder_methods Provides support for #find_by and dynamic finders #find_by, dynamic finders #[]
:last Provides #last!, but leaves Sequel's #last intact given its intuitive sort. Sorts differently than ActiveRecord. #last, #last! #last

Semantic Versioning

This gem is released responsibly and follows semantic versioning best practices.

To automatically receive new features as they're released:

gem 'sequel-active_record', '~> 1.0'

To automatically receive bugfixes, but no new features:

gem 'sequel-active_record', '~> 1.0.0'

Contributing

Bug reports and pull requests are certainly welcome at https://github.com/kenaniah/sequel-active_record.

I'm hoping to build a community around this gem, and am currently looking for maintainers who are interested in driving this project forward :-)